﻿Imports System.Text
Public Class JQueryUIDateTimePickerJS

    Public Overrides Function ToString() As String
        Dim sb As New StringBuilder
        sb.AppendLine("/*")
        sb.AppendLine(" *  JQuery UI DateTimePicker v1.0.4")
        sb.AppendLine(" *  ")
        sb.AppendLine(" *  Copyright (c) 2010 Daniel Harrod")
        sb.AppendLine(" *  Dual licensed under the MIT License (http://www.opensource.org/licenses/mit-license.php)")
        sb.AppendLine(" *  and GPL ( http://www.gnu.org/copyleft/gpl.html )")
        sb.AppendLine(" *")
        sb.AppendLine(" *  Portions of [JQuery UI Datepicker 1.8rc3] were modified on March 10, 2010. ")
        sb.AppendLine(" *  Portions of [Date Format 1.2.3] were modified on March 10, 2010.    ")
        sb.AppendLine(" *  ")
        sb.AppendLine(" *  ")
        sb.AppendLine(" *")
        sb.AppendLine(" *  Depends:")
        sb.AppendLine(" *    jquery.ui.core.js")
        sb.AppendLine("**/")
        sb.AppendLine("")
        sb.AppendLine("/*")
        sb.AppendLine(" *   1.0.4 ")
        sb.AppendLine(" *        In 1.0.1 changing getYear() to getFullYear() broke the absolute year determination, which is a must have.  ")
        sb.AppendLine(" *        ff, chr, saf getYear returns number of years since 1900, some of the others return century+year")
        sb.AppendLine(" *        ")
        sb.AppendLine(" *   1.0.3")
        sb.AppendLine(" *        Added Analog clock, minute overlay, hour overlay, minute, and hour hands.")
        sb.AppendLine(" *        New option: show24HourClock defaulted to false.")
        sb.AppendLine(" *        When show24HourClock is true, requires jquery.ui.datetimepicker.css")
        sb.AppendLine(" *   1.0.2")
        sb.AppendLine(" *        Tweaked for JQuery-UI 1.8.7 and JQuery 1.4.4 - thanks again Carl G.")
        sb.AppendLine(" *   1.0.1 ")
        sb.AppendLine(" *     Correction:")
        sb.AppendLine(" *        changed getYear() to getFullYear()")
        sb.AppendLine(" *   1.0.0 Overview:")
        sb.AppendLine(" *     Additions:")
        sb.AppendLine(" *        Incude Hours / Minutes / AMPM dropdowns.")
        sb.AppendLine(" *        Absolute year determination based on absolute minimum variance to present year.")
        sb.AppendLine(" *")
        sb.AppendLine(" *     Replacements:")
        sb.AppendLine(" *        Replaced [JQuery UI Datepicker 1.8rc3] inbound parsing with a simple date check Date(inbound)")
        sb.AppendLine(" *      ")
        sb.AppendLine(" *        Replaced outbound formatting with format string based on [Date Format 1.2.3]")
        sb.AppendLine(" *")
        sb.AppendLine(" *        Changed [Date Format 1.2.3] function names to play nice with [JQuery UI Datepicker 1.8rc3]   ")
        sb.AppendLine(" *        ")
        sb.AppendLine(" *        Minor tweaks")
        sb.AppendLine("**/")
        sb.AppendLine("")
        sb.AppendLine("/*")
        sb.AppendLine("* jQuery UI Datepicker 1.8rc3")
        sb.AppendLine("*")
        sb.AppendLine("* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)")
        sb.AppendLine("* Dual licensed under the MIT (MIT-LICENSE.txt)")
        sb.AppendLine("* and GPL (GPL-LICENSE.txt) licenses.")
        sb.AppendLine("*")
        sb.AppendLine("* http://docs.jquery.com/UI/Datepicker")
        sb.AppendLine("*")
        sb.AppendLine("* Depends:")
        sb.AppendLine("*	jquery.ui.core.js")
        sb.AppendLine("*/")
        sb.AppendLine("")
        sb.AppendLine("/*")
        sb.AppendLine("* Date Format 1.2.3")
        sb.AppendLine("* (c) 2007-2009 Steven Levithan <stevenlevithan.com>")
        sb.AppendLine("* MIT license")
        sb.AppendLine("*")
        sb.AppendLine("* Includes enhancements by Scott Trenda <scott.trenda.net>")
        sb.AppendLine("* and Kris Kowal <cixar.com/~kris.kowal/>")
        sb.AppendLine("*")
        sb.AppendLine("* Accepts a date, a mask, or a date and a mask.")
        sb.AppendLine("* Returns a formatted version of the given date.")
        sb.AppendLine("* The date defaults to the current date/time.")
        sb.AppendLine("* The mask defaults to dateFormat.masks.default.")
        sb.AppendLine("*/")
        sb.AppendLine("")
        sb.AppendLine("")
        sb.AppendLine("(function($) { // hide the namespace")
        sb.AppendLine("")
        sb.AppendLine("    $.extend($.ui, { datetimepicker: { version: ""1.0.0""} });")
        sb.AppendLine("")
        sb.AppendLine("    var PROP_NAME = 'datetimepicker';")
        sb.AppendLine("    var dpuuid = new Date().getTime();")
        sb.AppendLine("")
        sb.AppendLine("    /* Date picker manager.")
        sb.AppendLine("    Use the singleton instance of this class, $.datetimepicker, to interact with the date picker.")
        sb.AppendLine("    Settings for (groups of) date pickers are maintained in an instance object,")
        sb.AppendLine("    allowing multiple different settings on the same page. */")
        sb.AppendLine("")
        sb.AppendLine("    function Datetimepicker() {")
        sb.AppendLine("        this.debug = false; // Change this to true to start debugging")
        sb.AppendLine("        this._curInst = null; // The current instance in use")
        sb.AppendLine("        this._keyEvent = false; // If the last event was a key event")
        sb.AppendLine("        this._disabledInputs = []; // List of date picker inputs that have been disabled")
        sb.AppendLine("        this._datepickerShowing = false; // True if the popup picker is showing , false if not")
        sb.AppendLine("        this._inDialog = false; // True if showing within a ""dialog"", false if not")
        sb.AppendLine("        this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division")
        sb.AppendLine("        this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class")
        sb.AppendLine("        this._appendClass = 'ui-datepicker-append'; // The name of the append marker class")
        sb.AppendLine("        this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class")
        sb.AppendLine("        this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class")
        sb.AppendLine("        this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class")
        sb.AppendLine("        this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class")
        sb.AppendLine("        this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class")
        sb.AppendLine("        this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class")
        sb.AppendLine("        this.regional = []; // Available regional settings, indexed by language code")
        sb.AppendLine("        this.regional[''] = { // Default regional settings")
        sb.AppendLine("            closeText: 'Close', // Display text for close link")
        sb.AppendLine("            prevText: 'Prev', // Display text for previous month link")
        sb.AppendLine("            nextText: 'Next', // Display text for next month link")
        sb.AppendLine("            currentText: 'Now', // Display text for current month link")
        sb.AppendLine("            monthNames: ['January', 'February', 'March', 'April', 'May', 'June',")
        sb.AppendLine("			'July', 'August', 'September', 'October', 'November', 'December'], // Names of months for drop-down and formatting")
        sb.AppendLine("            monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting")
        sb.AppendLine("            dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting")
        sb.AppendLine("            dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting")
        sb.AppendLine("            dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], // Column headings for days starting at Sunday")
        sb.AppendLine("            weekHeader: 'Wk', // Column header for week of the year")
        sb.AppendLine("            dateFormat: 'mm/dd/yyyy hh:MM TT', // See format options on parseDate")
        sb.AppendLine("            /*  format options.")
        sb.AppendLine("            dd     - Day of the month as digits; leading zero for single-digit days. ")
        sb.AppendLine("            ddd    - Day of the week as a three-letter abbreviation. ")
        sb.AppendLine("            dddd   - Day of the week as its full name. ")
        sb.AppendLine("            m      - Month as digits; no leading zero for single-digit months. ")
        sb.AppendLine("            mm     - Month as digits; leading zero for single-digit months. ")
        sb.AppendLine("            mmm    - Month as a three-letter abbreviation. ")
        sb.AppendLine("            mmmm   - Month as its full name. ")
        sb.AppendLine("            yy     - Year as last two digits; leading zero for years less than 10. ")
        sb.AppendLine("            yyyy   - Year represented by four digits. ")
        sb.AppendLine("            h      - Hours; no leading zero for single-digit hours (12-hour clock). ")
        sb.AppendLine("            hh     - Hours; leading zero for single-digit hours (12-hour clock). ")
        sb.AppendLine("            H      - Hours; no leading zero for single-digit hours (24-hour clock). ")
        sb.AppendLine("            HH     - Hours; leading zero for single-digit hours (24-hour clock). ")
        sb.AppendLine("            M      - Minutes; no leading zero for single-digit minutes.")
        sb.AppendLine("            Uppercase M unlike CF timeFormat's m to avoid conflict with months. ")
        sb.AppendLine("            MM     - Minutes; leading zero for single-digit minutes.")
        sb.AppendLine("            Uppercase MM unlike CF timeFormat's mm to avoid conflict with months. ")
        sb.AppendLine("            s      - Seconds; no leading zero for single-digit seconds. ")
        sb.AppendLine("            ss     - Seconds; leading zero for single-digit seconds. ")
        sb.AppendLine("            l or L - Milliseconds. l gives 3 digits. L gives 2 digits. ")
        sb.AppendLine("            t      - Lowercase, single-character time marker string: a or p.")
        sb.AppendLine("            No equivalent in CF. ")
        sb.AppendLine("            tt     - Lowercase, two-character time marker string: am or pm.")
        sb.AppendLine("            No equivalent in CF. ")
        sb.AppendLine("            T      - Uppercase, single-character time marker string: A or P.")
        sb.AppendLine("            Uppercase T unlike CF's t to allow for user-specified casing. ")
        sb.AppendLine("            TT     - Uppercase, two-character time marker string: AM or PM.")
        sb.AppendLine("            Uppercase TT unlike CF's tt to allow for user-specified casing. ")
        sb.AppendLine("            Z      - US timezone abbreviation, e.g. EST or MDT. With non-US timezones or in the Opera browser, the GMT/UTC offset is returned, e.g. GMT-0500")
        sb.AppendLine("            No equivalent in CF. ")
        sb.AppendLine("            o      - GMT/UTC timezone offset, e.g. -0500 or +0230.")
        sb.AppendLine("            No equivalent in CF. ")
        sb.AppendLine("            S      - The date's ordinal suffix (st, nd, rd, or th). Works well with d.")
        sb.AppendLine("            No equivalent in CF. ")
        sb.AppendLine("            '…' or ""…"" - Literal character sequence. Surrounding quotes are removed.")
        sb.AppendLine("            No equivalent in CF. ")
        sb.AppendLine("            UTC:   - Must be the first four characters of the mask. Converts the date from local time to UTC/GMT/Zulu time before applying the mask. The ""UTC:"" prefix is removed.")
        sb.AppendLine("            No equivalent in CF. ")
        sb.AppendLine("         ")
        sb.AppendLine("            ""default"": ""ddd mmm dd yyyy HH:MM:ss"",")
        sb.AppendLine("            shortDate: ""m/d/yy"",")
        sb.AppendLine("            mediumDate: ""mmm d, yyyy"",")
        sb.AppendLine("            longDate: ""mmmm d, yyyy"",")
        sb.AppendLine("            fullDate: ""dddd, mmmm d, yyyy"",")
        sb.AppendLine("            shortTime: ""h:MM TT"",")
        sb.AppendLine("            mediumTime: ""h:MM:ss TT"",")
        sb.AppendLine("            longTime: ""h:MM:ss TT Z"",")
        sb.AppendLine("            isoDate: ""yyyy-mm-dd"",")
        sb.AppendLine("            isoTime: ""HH:MM:ss"",")
        sb.AppendLine("            isoDateTime: ""yyyy-mm-dd'T'HH:MM:ss"",")
        sb.AppendLine("            isoUtcDateTime: ""UTC:yyyy-mm-dd'T'HH:MM:ss'Z'""")
        sb.AppendLine("            */")
        sb.AppendLine("            firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...")
        sb.AppendLine("            isRTL: false, // True if right-to-left language, false if left-to-right")
        sb.AppendLine("            showMonthAfterYear: false, // True if the year select precedes month, false for month then year")
        sb.AppendLine("            yearSuffix: '' // Additional text to append to the year in the month headers")
        sb.AppendLine("        };")
        sb.AppendLine("        this._defaults = { // Global defaults for all the date picker instances")
        sb.AppendLine("            showOn: 'focus', // 'focus' for popup on focus,")
        sb.AppendLine("            // 'button' for trigger button, or 'both' for either")
        sb.AppendLine("            showAnim: 'show', // Name of jQuery animation for popup")
        sb.AppendLine("            showOptions: {}, // Options for enhanced animations")
        sb.AppendLine("            defaultDate: null, // Used when field is blank: actual date,")
        sb.AppendLine("            // +/-number for offset from today, null for today")
        sb.AppendLine("            appendText: '', // Display text following the input box, e.g. showing the format")
        sb.AppendLine("            buttonText: '...', // Text for trigger button")
        sb.AppendLine("            buttonImage: '', // URL for trigger button image")
        sb.AppendLine("            buttonImageOnly: false, // True if the image appears alone, false if it appears on a button")
        sb.AppendLine("            hideIfNoPrevNext: false, // True to hide next/previous month links")
        sb.AppendLine("            // if not applicable, false to just disable them")
        sb.AppendLine("            navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links")
        sb.AppendLine("            gotoCurrent: false, // True if today link goes back to current selection instead")
        sb.AppendLine("            changeMonth: false, // True if month can be selected directly, false if only prev/next")
        sb.AppendLine("            changeYear: false, // True if year can be selected directly, false if only prev/next")
        sb.AppendLine("            yearRange: 'c-10:c+10', // Range of years to display in drop-down,")
        sb.AppendLine("            // either relative to today's year (-nn:+nn), relative to currently displayed year")
        sb.AppendLine("            // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)")
        sb.AppendLine("            showOtherMonths: false, // True to show dates in other months, false to leave blank")
        sb.AppendLine("            selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable")
        sb.AppendLine("            showWeek: false, // True to show week of the year, false to not show it")
        sb.AppendLine("            calculateWeek: this.iso8601Week, // How to calculate the week of the year,")
        sb.AppendLine("            // takes a Date and returns the number of the week for it")
        sb.AppendLine("            shortYearCutoff: '+10', // Short year values < this are in the current century,")
        sb.AppendLine("            // > this are in the previous century,")
        sb.AppendLine("            // string value starting with '+' for current year + value")
        sb.AppendLine("            minDate: null, // The earliest selectable date, or null for no limit")
        sb.AppendLine("            maxDate: null, // The latest selectable date, or null for no limit")
        sb.AppendLine("            duration: '_default', // Duration of display/closure")
        sb.AppendLine("            beforeShowDay: null, // Function that takes a date and returns an array with")
        sb.AppendLine("            // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',")
        sb.AppendLine("            // [2] = cell title (optional), e.g. $.datetimepicker.noWeekends")
        sb.AppendLine("            beforeShow: null, // Function that takes an input field and")
        sb.AppendLine("            // returns a set of custom settings for the date picker")
        sb.AppendLine("            onSelect: null, // Define a callback function when a date is selected")
        sb.AppendLine("            onChangeMonthYear: null, // Define a callback function when the month or year is changed")
        sb.AppendLine("            onClose: null, // Define a callback function when the datepicker is closed")
        sb.AppendLine("            numberOfMonths: 1, // Number of months to show at a time")
        sb.AppendLine("            showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)")
        sb.AppendLine("            stepMonths: 1, // Number of months to step back/forward")
        sb.AppendLine("            stepBigMonths: 12, // Number of months to step back/forward for the big links")
        sb.AppendLine("            altField: '', // Selector for an alternate field to store selected dates into")
        sb.AppendLine("            altFormat: '', // The date format to use for the alternate field")
        sb.AppendLine("            constrainInput: false, // The input is constrained by the current date format")
        sb.AppendLine("            showButtonPanel: false, // True to show button panel, false to not show it")
        sb.AppendLine("            autoSize: false, // True to size the input for the date format, false to leave as is")
        sb.AppendLine("            show24HourClock: false //True to display an analog clock to pick time and hour")
        sb.AppendLine("        };")
        sb.AppendLine("        $.extend(this._defaults, this.regional['']);")
        sb.AppendLine("        var div = '<div id=""' + this._mainDivId + '"" class=""ui-datepicker ';")
        sb.AppendLine("        div += 'ui-widget ui-widget-content ui-helper-clearfix ui-corner-all""></div>';")
        sb.AppendLine("        this.dpDiv = $(div);")
        sb.AppendLine("    }")
        sb.AppendLine("")
        sb.AppendLine("    $.extend(Datetimepicker.prototype, {")
        sb.AppendLine("        /* Class name added to elements to indicate already configured with a date picker. */")
        sb.AppendLine("        markerClassName: 'hasDatetimepicker',")
        sb.AppendLine("")
        sb.AppendLine("        /* Debug logging (if enabled). */")
        sb.AppendLine("        log: function() {")
        sb.AppendLine("            if (this.debug)")
        sb.AppendLine("                console.log.apply('', arguments);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        // TODO rename to ""widget"" when switching to widget factory")
        sb.AppendLine("        _widgetDatepicker: function() {")
        sb.AppendLine("            return this.dpDiv;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Override the default settings for all instances of the date picker.")
        sb.AppendLine("        @param  settings  object - the new settings to use as defaults (anonymous object)")
        sb.AppendLine("        @return the manager object */")
        sb.AppendLine("        setDefaults: function(settings) {")
        sb.AppendLine("            extendRemove(this._defaults, settings || {});")
        sb.AppendLine("            return this;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Attach the date picker to a jQuery selection.")
        sb.AppendLine("        @param  target    element - the target input field or division or span")
        sb.AppendLine("        @param  settings  object - the new settings to use for this date picker instance (anonymous) */")
        sb.AppendLine("        _attachDatepicker: function(target, settings) {")
        sb.AppendLine("            // check for settings on the control itself - in namespace 'date:'")
        sb.AppendLine("            var inlineSettings = null;")
        sb.AppendLine("            for (var attrName in this._defaults) {")
        sb.AppendLine("                var attrValue = target.getAttribute('date:' + attrName);")
        sb.AppendLine("                if (attrValue) {")
        sb.AppendLine("                    inlineSettings = inlineSettings || {};")
        sb.AppendLine("                    try {")
        sb.AppendLine("                        inlineSettings[attrName] = eval(attrValue);")
        sb.AppendLine("                    } catch (err) {")
        sb.AppendLine("                        inlineSettings[attrName] = attrValue;")
        sb.AppendLine("                    }")
        sb.AppendLine("                }")
        sb.AppendLine("            }")
        sb.AppendLine("            var nodeName = target.nodeName.toLowerCase();")
        sb.AppendLine("            var inline = (nodeName == 'div' || nodeName == 'span');")
        sb.AppendLine("            if (!target.id)")
        sb.AppendLine("                target.id = 'dp' + (++this.uuid);")
        sb.AppendLine("            var inst = this._newInst($(target), inline);")
        sb.AppendLine("            inst.settings = $.extend({}, settings || {}, inlineSettings || {});")
        sb.AppendLine("            if (nodeName == 'input') {")
        sb.AppendLine("                this._connectDatepicker(target, inst);")
        sb.AppendLine("            } else if (inline) {")
        sb.AppendLine("                this._inlineDatepicker(target, inst);")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Create a new instance object. */")
        sb.AppendLine("        _newInst: function(target, inline) {")
        sb.AppendLine("            var id = target[0].id.replace(/([^A-Za-z0-9_])/g, '\\\\$1'); // escape jQuery meta chars")
        sb.AppendLine("            return { id: id, input: target, // associated target")
        sb.AppendLine("                selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection")
        sb.AppendLine("                drawMonth: 0, drawYear: 0, // month being drawn")
        sb.AppendLine("                inline: inline, // is datepicker inline or not")
        sb.AppendLine("                dpDiv: (!inline ? this.dpDiv : // presentation div")
        sb.AppendLine("			$('<div class=""' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all""></div>'))")
        sb.AppendLine("            };")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Attach the date picker to an input field. */")
        sb.AppendLine("        _connectDatepicker: function(target, inst) {")
        sb.AppendLine("            var input = $(target);")
        sb.AppendLine("            inst.append = $([]);")
        sb.AppendLine("            inst.trigger = $([]);")
        sb.AppendLine("            if (input.hasClass(this.markerClassName))")
        sb.AppendLine("                return;")
        sb.AppendLine("            this._attachments(input, inst);")
        sb.AppendLine("            input.addClass(this.markerClassName).keydown(this._doKeyDown).")
        sb.AppendLine("			keyup(this._doKeyUp).")
        sb.AppendLine("			bind(""setData.datepicker"", function(event, key, value) {")
        sb.AppendLine("			    inst.settings[key] = value;")
        sb.AppendLine("			}).bind(""getData.datepicker"", function(event, key) {")
        sb.AppendLine("			    return this._get(inst, key);")
        sb.AppendLine("			});")
        sb.AppendLine("            this._autoSize(inst);")
        sb.AppendLine("            $.data(target, PROP_NAME, inst);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Make attachments based on settings. */")
        sb.AppendLine("        _attachments: function(input, inst) {")
        sb.AppendLine("            var appendText = this._get(inst, 'appendText');")
        sb.AppendLine("            var isRTL = this._get(inst, 'isRTL');")
        sb.AppendLine("            if (inst.append)")
        sb.AppendLine("                inst.append.remove();")
        sb.AppendLine("            if (appendText) {")
        sb.AppendLine("                inst.append = $('<span class=""' + this._appendClass + '"">' + appendText + '</span>');")
        sb.AppendLine("                input[isRTL ? 'before' : 'after'](inst.append);")
        sb.AppendLine("            }")
        sb.AppendLine("            input.unbind('focus', this._showDatepicker);")
        sb.AppendLine("            if (inst.trigger)")
        sb.AppendLine("                inst.trigger.remove();")
        sb.AppendLine("            var showOn = this._get(inst, 'showOn');")
        sb.AppendLine("            if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field")
        sb.AppendLine("                input.focus(this._showDatepicker);")
        sb.AppendLine("            if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked")
        sb.AppendLine("                var buttonText = this._get(inst, 'buttonText');")
        sb.AppendLine("                var buttonImage = this._get(inst, 'buttonImage');")
        sb.AppendLine("                inst.trigger = $(this._get(inst, 'buttonImageOnly') ?")
        sb.AppendLine("				$('<img/>').addClass(this._triggerClass).")
        sb.AppendLine("					attr({ src: buttonImage, alt: buttonText, title: buttonText }) :")
        sb.AppendLine("				$('<button type=""button""></button>').addClass(this._triggerClass).")
        sb.AppendLine("					html(buttonImage == '' ? buttonText : $('<img/>').attr(")
        sb.AppendLine("					{ src: buttonImage, alt: buttonText, title: buttonText })));")
        sb.AppendLine("                input[isRTL ? 'before' : 'after'](inst.trigger);")
        sb.AppendLine("                inst.trigger.click(function() {")
        sb.AppendLine("                    if ($.datetimepicker._datepickerShowing && $.datetimepicker._lastInput == input[0])")
        sb.AppendLine("                        $.datetimepicker._hideDatepicker();")
        sb.AppendLine("                    else")
        sb.AppendLine("                        $.datetimepicker._showDatepicker(input[0]);")
        sb.AppendLine("                    return false;")
        sb.AppendLine("                });")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Apply the maximum length for the date format. */")
        sb.AppendLine("        _autoSize: function(inst) {")
        sb.AppendLine("            if (this._get(inst, 'autoSize') && !inst.inline) {")
        sb.AppendLine("                var date = new Date(2009, 12 - 1, 20); // Ensure double digits")
        sb.AppendLine("                var dateFormat = this._get(inst, 'dateFormat');")
        sb.AppendLine("                if (dateFormat.match(/[DM]/)) {")
        sb.AppendLine("                    var findMax = function(names) {")
        sb.AppendLine("                        var max = 0;")
        sb.AppendLine("                        var maxI = 0;")
        sb.AppendLine("                        for (var i = 0; i < names.length; i++) {")
        sb.AppendLine("                            if (names[i].length > max) {")
        sb.AppendLine("                                max = names[i].length;")
        sb.AppendLine("                                maxI = i;")
        sb.AppendLine("                            }")
        sb.AppendLine("                        }")
        sb.AppendLine("                        return maxI;")
        sb.AppendLine("                    };")
        sb.AppendLine("                    date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?")
        sb.AppendLine("					'monthNames' : 'monthNamesShort'))));")
        sb.AppendLine("                    date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?")
        sb.AppendLine("					'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());")
        sb.AppendLine("                }")
        sb.AppendLine("                inst.input.attr('size', this._formatDate(inst, date).length);")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Attach an inline date picker to a div. */")
        sb.AppendLine("        _inlineDatepicker: function(target, inst) {")
        sb.AppendLine("            var divSpan = $(target);")
        sb.AppendLine("            if (divSpan.hasClass(this.markerClassName))")
        sb.AppendLine("                return;")
        sb.AppendLine("            divSpan.addClass(this.markerClassName).append(inst.dpDiv).")
        sb.AppendLine("			bind(""setData.datepicker"", function(event, key, value) {")
        sb.AppendLine("			    inst.settings[key] = value;")
        sb.AppendLine("			}).bind(""getData.datepicker"", function(event, key) {")
        sb.AppendLine("			    return this._get(inst, key);")
        sb.AppendLine("			});")
        sb.AppendLine("            $.data(target, PROP_NAME, inst);")
        sb.AppendLine("            this._setDate(inst, this._getDefaultDate(inst), true);")
        sb.AppendLine("            this._updateDatepicker(inst);")
        sb.AppendLine("            this._updateAlternate(inst);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Pop-up the date picker in a ""dialog"" box.")
        sb.AppendLine("        @param  input     element - ignored")
        sb.AppendLine("        @param  date      string or Date - the initial date to display")
        sb.AppendLine("        @param  onSelect  function - the function to call when a date is selected")
        sb.AppendLine("        @param  settings  object - update the dialog date picker instance's settings (anonymous object)")
        sb.AppendLine("        @param  pos       int[2] - coordinates for the dialog's position within the screen or")
        sb.AppendLine("        event - with x/y coordinates or")
        sb.AppendLine("        leave empty for default (screen centre)")
        sb.AppendLine("        @return the manager object */")
        sb.AppendLine("        _dialogDatepicker: function(input, date, onSelect, settings, pos) {")
        sb.AppendLine("            var inst = this._dialogInst; // internal instance")
        sb.AppendLine("            if (!inst) {")
        sb.AppendLine("                var id = 'dp' + (++this.uuid);")
        sb.AppendLine("                this._dialogInput = $('<input type=""text"" id=""' + id +")
        sb.AppendLine("				'"" style=""position: absolute; top: -100px; width: 0px; z-index: -10;""/>');")
        sb.AppendLine("                this._dialogInput.keydown(this._doKeyDown);")
        sb.AppendLine("                $('body').append(this._dialogInput);")
        sb.AppendLine("                inst = this._dialogInst = this._newInst(this._dialogInput, false);")
        sb.AppendLine("                inst.settings = {};")
        sb.AppendLine("                $.data(this._dialogInput[0], PROP_NAME, inst);")
        sb.AppendLine("            }")
        sb.AppendLine("            extendRemove(inst.settings, settings || {});")
        sb.AppendLine("            date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);")
        sb.AppendLine("            this._dialogInput.val(date);")
        sb.AppendLine("")
        sb.AppendLine("            this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);")
        sb.AppendLine("            if (!this._pos) {")
        sb.AppendLine("                var browserWidth = document.documentElement.clientWidth;")
        sb.AppendLine("                var browserHeight = document.documentElement.clientHeight;")
        sb.AppendLine("                var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;")
        sb.AppendLine("                var scrollY = document.documentElement.scrollTop || document.body.scrollTop;")
        sb.AppendLine("                this._pos = // should use actual width/height below")
        sb.AppendLine("				[(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];")
        sb.AppendLine("            }")
        sb.AppendLine("")
        sb.AppendLine("            // move input on screen for focus, but hidden behind dialog")
        sb.AppendLine("            this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');")
        sb.AppendLine("            inst.settings.onSelect = onSelect;")
        sb.AppendLine("            this._inDialog = true;")
        sb.AppendLine("            this.dpDiv.addClass(this._dialogClass);")
        sb.AppendLine("            this._showDatepicker(this._dialogInput[0]);")
        sb.AppendLine("            if ($.blockUI)")
        sb.AppendLine("                $.blockUI(this.dpDiv);")
        sb.AppendLine("            $.data(this._dialogInput[0], PROP_NAME, inst);")
        sb.AppendLine("            return this;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Detach a datepicker from its control.")
        sb.AppendLine("        @param  target    element - the target input field or division or span */")
        sb.AppendLine("        _destroyDatepicker: function(target) {")
        sb.AppendLine("            var $target = $(target);")
        sb.AppendLine("            var inst = $.data(target, PROP_NAME);")
        sb.AppendLine("            if (!$target.hasClass(this.markerClassName)) {")
        sb.AppendLine("                return;")
        sb.AppendLine("            }")
        sb.AppendLine("            var nodeName = target.nodeName.toLowerCase();")
        sb.AppendLine("            $.removeData(target, PROP_NAME);")
        sb.AppendLine("            if (nodeName == 'input') {")
        sb.AppendLine("                inst.append.remove();")
        sb.AppendLine("                inst.trigger.remove();")
        sb.AppendLine("                $target.removeClass(this.markerClassName).")
        sb.AppendLine("				unbind('focus', this._showDatepicker).")
        sb.AppendLine("				unbind('keydown', this._doKeyDown).")
        sb.AppendLine("				unbind('keyup', this._doKeyUp);")
        sb.AppendLine("            } else if (nodeName == 'div' || nodeName == 'span')")
        sb.AppendLine("                $target.removeClass(this.markerClassName).empty();")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Enable the date picker to a jQuery selection.")
        sb.AppendLine("        @param  target    element - the target input field or division or span */")
        sb.AppendLine("        _enableDatepicker: function(target) {")
        sb.AppendLine("            var $target = $(target);")
        sb.AppendLine("            var inst = $.data(target, PROP_NAME);")
        sb.AppendLine("            if (!$target.hasClass(this.markerClassName)) {")
        sb.AppendLine("                return;")
        sb.AppendLine("            }")
        sb.AppendLine("            var nodeName = target.nodeName.toLowerCase();")
        sb.AppendLine("            if (nodeName == 'input') {")
        sb.AppendLine("                target.disabled = false;")
        sb.AppendLine("                inst.trigger.filter('button').")
        sb.AppendLine("				each(function() { this.disabled = false; }).end().")
        sb.AppendLine("				filter('img').css({ opacity: '1.0', cursor: '' });")
        sb.AppendLine("            }")
        sb.AppendLine("            else if (nodeName == 'div' || nodeName == 'span') {")
        sb.AppendLine("                var inline = $target.children('.' + this._inlineClass);")
        sb.AppendLine("                inline.children().removeClass('ui-state-disabled');")
        sb.AppendLine("            }")
        sb.AppendLine("            this._disabledInputs = $.map(this._disabledInputs,")
        sb.AppendLine("			function(value) { return (value == target ? null : value); }); // delete entry")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Disable the date picker to a jQuery selection.")
        sb.AppendLine("        @param  target    element - the target input field or division or span */")
        sb.AppendLine("        _disableDatepicker: function(target) {")
        sb.AppendLine("            var $target = $(target);")
        sb.AppendLine("            var inst = $.data(target, PROP_NAME);")
        sb.AppendLine("            if (!$target.hasClass(this.markerClassName)) {")
        sb.AppendLine("                return;")
        sb.AppendLine("            }")
        sb.AppendLine("            var nodeName = target.nodeName.toLowerCase();")
        sb.AppendLine("            if (nodeName == 'input') {")
        sb.AppendLine("                target.disabled = true;")
        sb.AppendLine("                inst.trigger.filter('button').")
        sb.AppendLine("				each(function() { this.disabled = true; }).end().")
        sb.AppendLine("				filter('img').css({ opacity: '0.5', cursor: 'default' });")
        sb.AppendLine("            }")
        sb.AppendLine("            else if (nodeName == 'div' || nodeName == 'span') {")
        sb.AppendLine("                var inline = $target.children('.' + this._inlineClass);")
        sb.AppendLine("                inline.children().addClass('ui-state-disabled');")
        sb.AppendLine("            }")
        sb.AppendLine("            this._disabledInputs = $.map(this._disabledInputs,")
        sb.AppendLine("			function(value) { return (value == target ? null : value); }); // delete entry")
        sb.AppendLine("            this._disabledInputs[this._disabledInputs.length] = target;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Is the first field in a jQuery collection disabled as a datepicker?")
        sb.AppendLine("        @param  target    element - the target input field or division or span")
        sb.AppendLine("        @return boolean - true if disabled, false if enabled */")
        sb.AppendLine("        _isDisabledDatepicker: function(target) {")
        sb.AppendLine("            if (!target) {")
        sb.AppendLine("                return false;")
        sb.AppendLine("            }")
        sb.AppendLine("            for (var i = 0; i < this._disabledInputs.length; i++) {")
        sb.AppendLine("                if (this._disabledInputs[i] == target)")
        sb.AppendLine("                    return true;")
        sb.AppendLine("            }")
        sb.AppendLine("            return false;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Retrieve the instance data for the target control.")
        sb.AppendLine("        @param  target  element - the target input field or division or span")
        sb.AppendLine("        @return  object - the associated instance data")
        sb.AppendLine("        @throws  error if a jQuery problem getting data */")
        sb.AppendLine("        _getInst: function(target) {")
        sb.AppendLine("            try {")
        sb.AppendLine("                return $.data(target, PROP_NAME);")
        sb.AppendLine("            }")
        sb.AppendLine("            catch (err) {")
        sb.AppendLine("                throw 'Missing instance data for this datepicker';")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Update or retrieve the settings for a date picker attached to an input field or division.")
        sb.AppendLine("        @param  target  element - the target input field or division or span")
        sb.AppendLine("        @param  name    object - the new settings to update or")
        sb.AppendLine("        string - the name of the setting to change or retrieve,")
        sb.AppendLine("        when retrieving also 'all' for all instance settings or")
        sb.AppendLine("        'defaults' for all global defaults")
        sb.AppendLine("        @param  value   any - the new value for the setting")
        sb.AppendLine("        (omit if above is an object or to retrieve a value) */")
        sb.AppendLine("        _optionDatepicker: function(target, name, value) {")
        sb.AppendLine("            var inst = this._getInst(target);")
        sb.AppendLine("            if (arguments.length == 2 && typeof name == 'string') {")
        sb.AppendLine("                return (name == 'defaults' ? $.extend({}, $.datetimepicker._defaults) :")
        sb.AppendLine("				(inst ? (name == 'all' ? $.extend({}, inst.settings) :")
        sb.AppendLine("				this._get(inst, name)) : null));")
        sb.AppendLine("            }")
        sb.AppendLine("            var settings = name || {};")
        sb.AppendLine("            if (typeof name == 'string') {")
        sb.AppendLine("                settings = {};")
        sb.AppendLine("                settings[name] = value;")
        sb.AppendLine("            }")
        sb.AppendLine("            if (inst) {")
        sb.AppendLine("                if (this._curInst == inst) {")
        sb.AppendLine("                    this._hideDatepicker();")
        sb.AppendLine("                }")
        sb.AppendLine("                var date = this._getDateDatepicker(target, true);")
        sb.AppendLine("                extendRemove(inst.settings, settings);")
        sb.AppendLine("                this._attachments($(target), inst);")
        sb.AppendLine("                this._autoSize(inst);")
        sb.AppendLine("                this._setDateDatepicker(target, date);")
        sb.AppendLine("                this._updateDatepicker(inst);")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        // change method deprecated")
        sb.AppendLine("        _changeDatepicker: function(target, name, value) {")
        sb.AppendLine("            this._optionDatepicker(target, name, value);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Redraw the date picker attached to an input field or division.")
        sb.AppendLine("        @param  target  element - the target input field or division or span */")
        sb.AppendLine("        _refreshDatepicker: function(target) {")
        sb.AppendLine("            var inst = this._getInst(target);")
        sb.AppendLine("            if (inst) {")
        sb.AppendLine("                this._updateDatepicker(inst);")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Set the dates for a jQuery selection.")
        sb.AppendLine("        @param  target   element - the target input field or division or span")
        sb.AppendLine("        @param  date     Date - the new date */")
        sb.AppendLine("        _setDateDatepicker: function(target, date) {")
        sb.AppendLine("            var inst = this._getInst(target);")
        sb.AppendLine("            if (inst) {")
        sb.AppendLine("                this._setDate(inst, date);")
        sb.AppendLine("                this._updateDatepicker(inst);")
        sb.AppendLine("                this._updateAlternate(inst);")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Get the date(s) for the first entry in a jQuery selection.")
        sb.AppendLine("        @param  target     element - the target input field or division or span")
        sb.AppendLine("        @param  noDefault  boolean - true if no default date is to be used")
        sb.AppendLine("        @return Date - the current date */")
        sb.AppendLine("        _getDateDatepicker: function(target, noDefault) {")
        sb.AppendLine("            var inst = this._getInst(target);")
        sb.AppendLine("            if (inst && !inst.inline)")
        sb.AppendLine("                this._setDateFromField(inst, noDefault);")
        sb.AppendLine("            return (inst ? this._getDate(inst) : null);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Handle keystrokes. */")
        sb.AppendLine("        _doKeyDown: function(event) {")
        sb.AppendLine("            var inst = $.datetimepicker._getInst(event.target);")
        sb.AppendLine("            var handled = true;")
        sb.AppendLine("            var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');")
        sb.AppendLine("            inst._keyEvent = true;")
        sb.AppendLine("            if ($.datetimepicker._datepickerShowing)")
        sb.AppendLine("                switch (event.keyCode) {")
        sb.AppendLine("                case 9: $.datetimepicker._hideDatepicker();")
        sb.AppendLine("                    handled = false;")
        sb.AppendLine("                    break; // hide on tab out")
        sb.AppendLine("                case 13: var sel = $('td.' + $.datetimepicker._dayOverClass, inst.dpDiv).")
        sb.AppendLine("							add($('td.' + $.datetimepicker._currentClass, inst.dpDiv));")
        sb.AppendLine("                    if (sel[0])")
        sb.AppendLine("                        $.datetimepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0], inst.currentHour, inst.currentMinute, inst.currentAMPM);")
        sb.AppendLine("                    else")
        sb.AppendLine("                        $.datetimepicker._hideDatepicker();")
        sb.AppendLine("                    return false; // don't submit the form")
        sb.AppendLine("                    break; // select the value on enter")
        sb.AppendLine("                case 27: $.datetimepicker._hideDatepicker();")
        sb.AppendLine("                    break; // hide on escape")
        sb.AppendLine("                case 33: $.datetimepicker._adjustDate(event.target, (event.ctrlKey ?")
        sb.AppendLine("							-$.datetimepicker._get(inst, 'stepBigMonths') :")
        sb.AppendLine("							-$.datetimepicker._get(inst, 'stepMonths')), 'M');")
        sb.AppendLine("                    break; // previous month/year on page up/+ ctrl")
        sb.AppendLine("                case 34: $.datetimepicker._adjustDate(event.target, (event.ctrlKey ?")
        sb.AppendLine("							+$.datetimepicker._get(inst, 'stepBigMonths') :")
        sb.AppendLine("							+$.datetimepicker._get(inst, 'stepMonths')), 'M');")
        sb.AppendLine("                    break; // next month/year on page down/+ ctrl")
        sb.AppendLine("                case 35: if (event.ctrlKey || event.metaKey) $.datetimepicker._clearDate(event.target);")
        sb.AppendLine("                    handled = event.ctrlKey || event.metaKey;")
        sb.AppendLine("                    break; // clear on ctrl or command +end")
        sb.AppendLine("                case 36: if (event.ctrlKey || event.metaKey) $.datetimepicker._gotoToday(event.target);")
        sb.AppendLine("                    handled = event.ctrlKey || event.metaKey;")
        sb.AppendLine("                    break; // current on ctrl or command +home")
        sb.AppendLine("                case 37: if (event.ctrlKey || event.metaKey) $.datetimepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');")
        sb.AppendLine("                    handled = event.ctrlKey || event.metaKey;")
        sb.AppendLine("                    // -1 day on ctrl or command +left")
        sb.AppendLine("                    if (event.originalEvent.altKey) $.datetimepicker._adjustDate(event.target, (event.ctrlKey ?")
        sb.AppendLine("									-$.datetimepicker._get(inst, 'stepBigMonths') :")
        sb.AppendLine("									-$.datetimepicker._get(inst, 'stepMonths')), 'M');")
        sb.AppendLine("                    // next month/year on alt +left on Mac")
        sb.AppendLine("                    break;")
        sb.AppendLine("                case 38: if (event.ctrlKey || event.metaKey) $.datetimepicker._adjustDate(event.target, -7, 'D');")
        sb.AppendLine("                    handled = event.ctrlKey || event.metaKey;")
        sb.AppendLine("                    break; // -1 week on ctrl or command +up")
        sb.AppendLine("                case 39: if (event.ctrlKey || event.metaKey) $.datetimepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');")
        sb.AppendLine("                    handled = event.ctrlKey || event.metaKey;")
        sb.AppendLine("                    // +1 day on ctrl or command +right")
        sb.AppendLine("                    if (event.originalEvent.altKey) $.datetimepicker._adjustDate(event.target, (event.ctrlKey ?")
        sb.AppendLine("									+$.datetimepicker._get(inst, 'stepBigMonths') :")
        sb.AppendLine("									+$.datetimepicker._get(inst, 'stepMonths')), 'M');")
        sb.AppendLine("                    // next month/year on alt +right")
        sb.AppendLine("                    break;")
        sb.AppendLine("                case 40: if (event.ctrlKey || event.metaKey) $.datetimepicker._adjustDate(event.target, +7, 'D');")
        sb.AppendLine("                    handled = event.ctrlKey || event.metaKey;")
        sb.AppendLine("                    break; // +1 week on ctrl or command +down")
        sb.AppendLine("                default: handled = false;")
        sb.AppendLine("            }")
        sb.AppendLine("            else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home")
        sb.AppendLine("                $.datetimepicker._showDatepicker(this);")
        sb.AppendLine("            else {")
        sb.AppendLine("                handled = false;")
        sb.AppendLine("            }")
        sb.AppendLine("            if (handled) {")
        sb.AppendLine("                event.preventDefault();")
        sb.AppendLine("                event.stopPropagation();")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        // Javascript does not offer Left function")
        sb.AppendLine("        _Left: function(str, name) {")
        sb.AppendLine("            if (n <= 0)")
        sb.AppendLine("                return """";")
        sb.AppendLine("            else if (n > String(str).length)")
        sb.AppendLine("                return str;")
        sb.AppendLine("            else")
        sb.AppendLine("                return String(str).substring(0, n);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        // Determines Year, primarily for the century, by picking the closest.")
        sb.AppendLine("        // 77 will choose 1977, 10 will choose 2010")
        sb.AppendLine("        _DetermineYear: function(year) {")
        sb.AppendLine("            var yearLength = String(year).length;")
        sb.AppendLine("            var CurrentDate = new Date();")
        sb.AppendLine("            var PresentYear = CurrentDate.getFullYear();")
        sb.AppendLine("            switch (yearLength) {")
        sb.AppendLine("                case 0:")
        sb.AppendLine("                    alert(CurrentDate.getFullYear());")
        sb.AppendLine("                    return CurrentDate.getFullYear();")
        sb.AppendLine("                    break;")
        sb.AppendLine("                case 1:")
        sb.AppendLine("                    return '200' + year;")
        sb.AppendLine("                    break;")
        sb.AppendLine("                case 2:")
        sb.AppendLine("                    var FutureYear = parseInt('20' + year);")
        sb.AppendLine("                    var PastYear = parseInt('19' + year);")
        sb.AppendLine("                    var FutureDiff = Math.abs(FutureYear - PresentYear);")
        sb.AppendLine("                    var PastDiff = Math.abs(PastYear - PresentYear);")
        sb.AppendLine("                    if (PastDiff < FutureDiff) {")
        sb.AppendLine("                        return PastYear;")
        sb.AppendLine("                    } else {")
        sb.AppendLine("                        return FutureYear;")
        sb.AppendLine("                    }")
        sb.AppendLine("                case 3:")
        sb.AppendLine("                    //unfortunately ff,chr,saf year returns getyear since 1900, while the other return the current year, so.")
        sb.AppendLine("                    var FutureYear = parseInt('20' + $.datetimepicker._Right(year, 2));")
        sb.AppendLine("                    var PastYear = parseInt('19' + $.datetimepicker._Right(year, 2));")
        sb.AppendLine("                    var FutureDiff = Math.abs(FutureYear - PresentYear);")
        sb.AppendLine("                    var PastDiff = Math.abs(PastYear - PresentYear);")
        sb.AppendLine("                    if (PastDiff < FutureDiff) {")
        sb.AppendLine("                        return PastYear;")
        sb.AppendLine("                    } else {")
        sb.AppendLine("                        return FutureYear;")
        sb.AppendLine("                    }")
        sb.AppendLine("")
        sb.AppendLine("                    break;")
        sb.AppendLine("                case 4:")
        sb.AppendLine("                    return year;")
        sb.AppendLine("                default:")
        sb.AppendLine("                    return _Left(year, 4);")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("        //\Date-Time-Picker")
        sb.AppendLine("")
        sb.AppendLine("        /* Synchronise manual entry and field/alternate field. */")
        sb.AppendLine("        _doKeyUp: function(event) {")
        sb.AppendLine("            var inst = $.datetimepicker._getInst(event.target);")
        sb.AppendLine("            if (inst.input.val() != inst.lastVal) {")
        sb.AppendLine("                try {")
        sb.AppendLine("")
        sb.AppendLine("                    //Date-Time-Picker")
        sb.AppendLine("                    var date = new Date(inst.input.val());")
        sb.AppendLine("                    if (date != ""NaN"") {")
        sb.AppendLine("                        //date.setYear($.datetimepicker._DetermineYear(date.getFullYear()));")
        sb.AppendLine("                        date.setYear($.datetimepicker._DetermineYear(date.getYear()));")
        sb.AppendLine("                        if (date) { // only if valid")
        sb.AppendLine("                            $.datetimepicker._setDateFromField(inst);")
        sb.AppendLine("                            $.datetimepicker._updateAlternate(inst);")
        sb.AppendLine("                            $.datetimepicker._updateDatepicker(inst);")
        sb.AppendLine("                        }")
        sb.AppendLine("                    }")
        sb.AppendLine("                }")
        sb.AppendLine("                catch (event) {")
        sb.AppendLine("                    $.datetimepicker.log(event);")
        sb.AppendLine("                }")
        sb.AppendLine("            }")
        sb.AppendLine("            return true;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Pop-up the date picker for a given input field.")
        sb.AppendLine("        @param  input  element - the input field attached to the date picker or")
        sb.AppendLine("        event - if triggered by focus */")
        sb.AppendLine("        _showDatepicker: function(input) {")
        sb.AppendLine("            input = input.target || input;")
        sb.AppendLine("            if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger")
        sb.AppendLine("                input = $('input', input.parentNode)[0];")
        sb.AppendLine("            if ($.datetimepicker._isDisabledDatepicker(input) || $.datetimepicker._lastInput == input) // already here")
        sb.AppendLine("                return;")
        sb.AppendLine("            var inst = $.datetimepicker._getInst(input);")
        sb.AppendLine("            if ($.datetimepicker._curInst && $.datetimepicker._curInst != inst) {")
        sb.AppendLine("                $.datetimepicker._curInst.dpDiv.stop(true, true);")
        sb.AppendLine("            }")
        sb.AppendLine("            var beforeShow = $.datetimepicker._get(inst, 'beforeShow');")
        sb.AppendLine("            extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));")
        sb.AppendLine("            inst.lastVal = null;")
        sb.AppendLine("            $.datetimepicker._lastInput = input;")
        sb.AppendLine("            $.datetimepicker._setDateFromField(inst);")
        sb.AppendLine("            if ($.datetimepicker._inDialog) // hide cursor")
        sb.AppendLine("                input.value = '';")
        sb.AppendLine("            if (!$.datetimepicker._pos) { // position below input")
        sb.AppendLine("                $.datetimepicker._pos = $.datetimepicker._findPos(input);")
        sb.AppendLine("                $.datetimepicker._pos[1] += input.offsetHeight; // add the height")
        sb.AppendLine("            }")
        sb.AppendLine("            var isFixed = false;")
        sb.AppendLine("            $(input).parents().each(function() {")
        sb.AppendLine("                isFixed |= $(this).css('position') == 'fixed';")
        sb.AppendLine("                return !isFixed;")
        sb.AppendLine("            });")
        sb.AppendLine("            if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled")
        sb.AppendLine("                $.datetimepicker._pos[0] -= document.documentElement.scrollLeft;")
        sb.AppendLine("                $.datetimepicker._pos[1] -= document.documentElement.scrollTop;")
        sb.AppendLine("            }")
        sb.AppendLine("            var offset = { left: $.datetimepicker._pos[0], top: $.datetimepicker._pos[1] };")
        sb.AppendLine("            $.datetimepicker._pos = null;")
        sb.AppendLine("            // determine sizing offscreen")
        sb.AppendLine("            inst.dpDiv.css({ position: 'absolute', display: 'block', top: '-1000px' });")
        sb.AppendLine("            $.datetimepicker._updateDatepicker(inst);")
        sb.AppendLine("            // fix width for dynamic number of date pickers")
        sb.AppendLine("            // and adjust position before showing")
        sb.AppendLine("            offset = $.datetimepicker._checkOffset(inst, offset, isFixed);")
        sb.AppendLine("            inst.dpDiv.css({ position: ($.datetimepicker._inDialog && $.blockUI ?")
        sb.AppendLine("			'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',")
        sb.AppendLine("                left: offset.left + 'px', top: offset.top + 'px'")
        sb.AppendLine("            });")
        sb.AppendLine("            if (!inst.inline) {")
        sb.AppendLine("                var showAnim = $.datetimepicker._get(inst, 'showAnim');")
        sb.AppendLine("                var duration = $.datetimepicker._get(inst, 'duration');")
        sb.AppendLine("                var postProcess = function() {")
        sb.AppendLine("                    $.datetimepicker._datepickerShowing = true;")
        sb.AppendLine("                    var borders = $.datetimepicker._getBorders(inst.dpDiv);")
        sb.AppendLine("                    inst.dpDiv.find('iframe.ui-datepicker-cover'). // IE6- only")
        sb.AppendLine("					css({ left: -borders[0], top: -borders[1],")
        sb.AppendLine("					    width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()")
        sb.AppendLine("					});")
        sb.AppendLine("                };")
        sb.AppendLine("                inst.dpDiv.zIndex($(input).zIndex() + 1);")
        sb.AppendLine("")
        sb.AppendLine("                if ($.effects && $.effects[showAnim])")
        sb.AppendLine("                    inst.dpDiv.show(showAnim, $.datetimepicker._get(inst, 'showOptions'), duration, postProcess);")
        sb.AppendLine("                else")
        sb.AppendLine("                    inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);")
        sb.AppendLine("                if (!showAnim)")
        sb.AppendLine("                    postProcess();")
        sb.AppendLine("                if (inst.input.is(':visible') && !inst.input.is(':disabled'))")
        sb.AppendLine("                    inst.input.focus();")
        sb.AppendLine("                $.datetimepicker._curInst = inst;")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Generate the date picker content. */")
        sb.AppendLine("        _updateDatepicker: function(inst) {")
        sb.AppendLine("            var self = this;")
        sb.AppendLine("            var borders = $.datetimepicker._getBorders(inst.dpDiv);")
        sb.AppendLine("            inst.dpDiv.empty().append(this._generateHTML(inst))")
        sb.AppendLine("			.find('iframe.ui-datepicker-cover') // IE6- only")
        sb.AppendLine("				.css({ left: -borders[0], top: -borders[1],")
        sb.AppendLine("				    width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()")
        sb.AppendLine("				})")
        sb.AppendLine("			.end()")
        sb.AppendLine("			.find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')")
        sb.AppendLine("				.bind('mouseout', function() {")
        sb.AppendLine("				    $(this).removeClass('ui-state-hover');")
        sb.AppendLine("				    if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');")
        sb.AppendLine("				    if (this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');")
        sb.AppendLine("				})")
        sb.AppendLine("				.bind('mouseover', function() {")
        sb.AppendLine("				    if (!self._isDisabledDatepicker(inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) {")
        sb.AppendLine("				        $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');")
        sb.AppendLine("				        $(this).addClass('ui-state-hover');")
        sb.AppendLine("				        if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');")
        sb.AppendLine("				        if (this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');")
        sb.AppendLine("				    }")
        sb.AppendLine("				})")
        sb.AppendLine("			.end()")
        sb.AppendLine("			.find('.' + this._dayOverClass + ' a')")
        sb.AppendLine("				.trigger('mouseover')")
        sb.AppendLine("			.end();")
        sb.AppendLine("            var numMonths = this._getNumberOfMonths(inst);")
        sb.AppendLine("            var cols = numMonths[1];")
        sb.AppendLine("            var width = 17;")
        sb.AppendLine("            if (cols > 1)")
        sb.AppendLine("                inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');")
        sb.AppendLine("            else")
        sb.AppendLine("                inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');")
        sb.AppendLine("            inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +")
        sb.AppendLine("			'Class']('ui-datepicker-multi');")
        sb.AppendLine("            inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +")
        sb.AppendLine("			'Class']('ui-datepicker-rtl');")
        sb.AppendLine("            var show24HourClock = this._get(inst, 'show24HourClock');")
        sb.AppendLine("")
        sb.AppendLine("            if (inst.currentHour != undefined) {")
        sb.AppendLine("                $(""#DP_jQuery_Hour_"" + dpuuid).val(inst.currentHour);")
        sb.AppendLine("                $(""#DP_jQuery_Minute_"" + dpuuid).val(inst.currentMinute);")
        sb.AppendLine("                $(""#DP_jQuery_AMPM_"" + dpuuid).val(inst.currentAMPM);")
        sb.AppendLine("")
        sb.AppendLine("                var Hour = inst.currentHour;")
        sb.AppendLine("                if (inst.currentAMPM == 'PM') {")
        sb.AppendLine("                    Hour = parseInt(Hour) + 12;")
        sb.AppendLine("                }")
        sb.AppendLine("                if (show24HourClock) {")
        sb.AppendLine("                    $.datetimepicker.DrawHours($(""#DP_jQuery_clock_"" + dpuuid)[0], Hour);")
        sb.AppendLine("                    $.datetimepicker.DrawMinutes($(""#DP_jQuery_clock_"" + dpuuid)[0], inst.currentMinute);")
        sb.AppendLine("                }")
        sb.AppendLine("            }")
        sb.AppendLine("")
        sb.AppendLine("            if (inst == $.datetimepicker._curInst && $.datetimepicker._datepickerShowing && inst.input &&")
        sb.AppendLine("				inst.input.is(':visible') && !inst.input.is(':disabled'))")
        sb.AppendLine("                inst.input.focus();")
        sb.AppendLine("")
        sb.AppendLine("            if (show24HourClock) {")
        sb.AppendLine("")
        sb.AppendLine("                /* Hour drop down changed change the clock */")
        sb.AppendLine("                $(""#DP_jQuery_Hour_"" + dpuuid).change(function(e) {")
        sb.AppendLine("                    var objID = this.id.split(""_"");")
        sb.AppendLine("                    var ID = objID[objID.length - 1];")
        sb.AppendLine("                    var Hour = $(""#DP_jQuery_Hour_"" + ID).val();")
        sb.AppendLine("                    var AMPM = $(""#DP_jQuery_AMPM_"" + ID).val();")
        sb.AppendLine("                    if (AMPM == 'PM')")
        sb.AppendLine("                        Hour = parseInt(Hour) + 12;")
        sb.AppendLine("                    $.datetimepicker.DrawHours($(""#DP_jQuery_clock_"" + ID)[0], Hour);")
        sb.AppendLine("                });")
        sb.AppendLine("")
        sb.AppendLine("                /* AM/PM drop down changed change the clock */")
        sb.AppendLine("                $(""#DP_jQuery_AMPM_"" + dpuuid).change(function(e) {")
        sb.AppendLine("                    var objID = this.id.split(""_"");")
        sb.AppendLine("                    var ID = objID[objID.length - 1];")
        sb.AppendLine("                    var Hour = $(""#DP_jQuery_Hour_"" + ID).val();")
        sb.AppendLine("                    var AMPM = $(""#DP_jQuery_AMPM_"" + ID).val();")
        sb.AppendLine("                    if (AMPM == 'PM')")
        sb.AppendLine("                        Hour = parseInt(Hour) + 12;")
        sb.AppendLine("                    $.datetimepicker.DrawHours($(""#DP_jQuery_clock_"" + ID)[0], Hour);")
        sb.AppendLine("                });")
        sb.AppendLine("")
        sb.AppendLine("                /* Minute drop down changed change the clock */")
        sb.AppendLine("                $(""#DP_jQuery_Minute_"" + dpuuid).change(function(e) {")
        sb.AppendLine("                    var objID = this.id.split(""_"");")
        sb.AppendLine("                    var ID = objID[objID.length - 1];")
        sb.AppendLine("                    $.datetimepicker.DrawMinutes($(""#DP_jQuery_clock_"" + ID)[0], $(""#DP_jQuery_Minute_"" + dpuuid).val());")
        sb.AppendLine("                });")
        sb.AppendLine("")
        sb.AppendLine("                /* Display area hilights */")
        sb.AppendLine("                $(""#DP_jQuery_clock_"" + dpuuid).mousemove(function(e) {")
        sb.AppendLine("                    var Pos = $.datetimepicker._findPos(this);")
        sb.AppendLine("")
        sb.AppendLine("                    var xOriginal = e.pageX - Pos[0] - 196;")
        sb.AppendLine("                    var yOriginal = e.pageY - Pos[1] - 196;")
        sb.AppendLine("                    var x = Math.abs(xOriginal);")
        sb.AppendLine("                    var y = Math.abs(yOriginal);")
        sb.AppendLine("")
        sb.AppendLine("                    var Distance = Math.sqrt((x * x) + (y * y))")
        sb.AppendLine("                    if (Distance > 129 && Distance < 196) {")
        sb.AppendLine("                        this.children[2].style.display = '';")
        sb.AppendLine("                    } else {")
        sb.AppendLine("                        this.children[2].style.display = 'none';")
        sb.AppendLine("                    }")
        sb.AppendLine("                    if (Distance <= 129 && Distance > 50) {")
        sb.AppendLine("                        this.children[3].style.display = '';")
        sb.AppendLine("                    } else {")
        sb.AppendLine("                        this.children[3].style.display = 'none';")
        sb.AppendLine("                    }")
        sb.AppendLine("")
        sb.AppendLine("                });")
        sb.AppendLine("")
        sb.AppendLine("                /* Calculate and move the appropriate minute or hour hand */")
        sb.AppendLine("                $(""#DP_jQuery_clock_"" + dpuuid).click(function(e) {")
        sb.AppendLine("")
        sb.AppendLine("                    var Pos = $.datetimepicker._findPos(this);")
        sb.AppendLine("")
        sb.AppendLine("                    var xOriginal = e.pageX - Pos[0] - 196;")
        sb.AppendLine("                    var yOriginal = e.pageY - Pos[1] - 196;")
        sb.AppendLine("")
        sb.AppendLine("                    /* Quadrant */")
        sb.AppendLine("                    var core = 0;")
        sb.AppendLine("")
        sb.AppendLine("                    if (xOriginal > 0 && yOriginal < 0) {")
        sb.AppendLine("                        core = 1;")
        sb.AppendLine("                    }")
        sb.AppendLine("                    if (xOriginal < 0 && yOriginal < 0) {")
        sb.AppendLine("                        core = 2;")
        sb.AppendLine("                    }")
        sb.AppendLine("")
        sb.AppendLine("                    if (xOriginal < 0 && yOriginal > 0) {")
        sb.AppendLine("                        core = 3;")
        sb.AppendLine("                    }")
        sb.AppendLine("                    if (xOriginal > 0 && yOriginal > 0) {")
        sb.AppendLine("                        core = 4;")
        sb.AppendLine("                    }")
        sb.AppendLine("")
        sb.AppendLine("                    var x = Math.abs(xOriginal);")
        sb.AppendLine("                    var y = Math.abs(yOriginal);")
        sb.AppendLine("")
        sb.AppendLine("                    var Distance = Math.sqrt((x * x) + (y * y))")
        sb.AppendLine("                    var InMinuteRange = false;")
        sb.AppendLine("                    if (Distance > 127 && Distance < 196) {")
        sb.AppendLine("                        InMinuteRange = true;")
        sb.AppendLine("                    }")
        sb.AppendLine("")
        sb.AppendLine("                    var InHourRange = false;")
        sb.AppendLine("                    if (Distance <= 129 && Distance > 50) {")
        sb.AppendLine("                        InHourRange = true;")
        sb.AppendLine("                    }")
        sb.AppendLine("")
        sb.AppendLine("                    var v;")
        sb.AppendLine("                    var Minute;")
        sb.AppendLine("                    k = y / Distance;")
        sb.AppendLine("")
        sb.AppendLine("                    /* Calculate the Math.Sin of the click position with the hour/minute position */")
        sb.AppendLine("                    if (core == 1) {")
        sb.AppendLine("                        if (k > 0.987)")
        sb.AppendLine("                            v = '12';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.987 && k > 0.922)")
        sb.AppendLine("                            v = '13';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.922 && k > 0.785)")
        sb.AppendLine("                            v = '14';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.785 && k > 0.600)")
        sb.AppendLine("                            v = '15';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.600 && k > 0.374)")
        sb.AppendLine("                            v = '16';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.374 && k > 0.152)")
        sb.AppendLine("                            v = '17';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.152)")
        sb.AppendLine("                            v = '18';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k > 0.998)")
        sb.AppendLine("                            Minute = '00';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.998 && k > 0.986)")
        sb.AppendLine("                            Minute = '01';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.986 && k > 0.955)")
        sb.AppendLine("                            Minute = '02';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.955 && k > 0.930)")
        sb.AppendLine("                            Minute = '03';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.930 && k > 0.893)")
        sb.AppendLine("                            Minute = '04';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.893 && k > 0.837)")
        sb.AppendLine("                            Minute = '05';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.837 && k > 0.774)")
        sb.AppendLine("                            Minute = '06';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.774 && k > 0.689)")
        sb.AppendLine("                            Minute = '07';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.689 && k > 0.621)")
        sb.AppendLine("                            Minute = '08';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.621 && k > 0.558)")
        sb.AppendLine("                            Minute = '09';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.558 && k > 0.472)")
        sb.AppendLine("                            Minute = '10'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.472 && k > 0.356)")
        sb.AppendLine("                            Minute = '11'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.356 && k > 0.228)")
        sb.AppendLine("                            Minute = '12'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.228 && k > 0.173)")
        sb.AppendLine("                            Minute = '13'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.173 && k > 0.082)")
        sb.AppendLine("                            Minute = '14'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.082)")
        sb.AppendLine("                            Minute = '15'")
        sb.AppendLine("                    }")
        sb.AppendLine("                    if (core == 2) {")
        sb.AppendLine("                        if (k > 0.987)")
        sb.AppendLine("                            v = '12';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.987 && k > 0.922)")
        sb.AppendLine("                            v = '11';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.922 && k > 0.785)")
        sb.AppendLine("                            v = '10';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.785 && k > 0.600)")
        sb.AppendLine("                            v = '09';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.600 && k > 0.374)")
        sb.AppendLine("                            v = '08';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.374 && k > 0.152)")
        sb.AppendLine("                            v = '07';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.152)")
        sb.AppendLine("                            v = '06';")
        sb.AppendLine("")
        sb.AppendLine("")
        sb.AppendLine("                        if (k > 0.998)")
        sb.AppendLine("                            Minute = '00';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.998 && k > 0.986)")
        sb.AppendLine("                            Minute = '59';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.986 && k > 0.955)")
        sb.AppendLine("                            Minute = '58';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.955 && k > 0.930)")
        sb.AppendLine("                            Minute = '57';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.930 && k > 0.893)")
        sb.AppendLine("                            Minute = '56';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.893 && k > 0.837)")
        sb.AppendLine("                            Minute = '55';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.837 && k > 0.774)")
        sb.AppendLine("                            Minute = '54';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.774 && k > 0.689)")
        sb.AppendLine("                            Minute = '53';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.689 && k > 0.621)")
        sb.AppendLine("                            Minute = '52';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.621 && k > 0.558)")
        sb.AppendLine("                            Minute = '51';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.558 && k > 0.472)")
        sb.AppendLine("                            Minute = '50'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.472 && k > 0.356)")
        sb.AppendLine("                            Minute = '49'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.356 && k > 0.228)")
        sb.AppendLine("                            Minute = '48'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.228 && k > 0.173)")
        sb.AppendLine("                            Minute = '47'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.173 && k > 0.082)")
        sb.AppendLine("                            Minute = '46'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.082)")
        sb.AppendLine("                            Minute = '45'")
        sb.AppendLine("                    }")
        sb.AppendLine("")
        sb.AppendLine("                    if (core == 3) {")
        sb.AppendLine("                        if (k > 0.987)")
        sb.AppendLine("                            v = '00';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.987 && k > 0.922)")
        sb.AppendLine("                            v = '01';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.922 && k > 0.785)")
        sb.AppendLine("                            v = '02';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.785 && k > 0.600)")
        sb.AppendLine("                            v = '03';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.600 && k > 0.374)")
        sb.AppendLine("                            v = '04';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.374 && k > 0.152)")
        sb.AppendLine("                            v = '05';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.152)")
        sb.AppendLine("                            v = '06';")
        sb.AppendLine("")
        sb.AppendLine("")
        sb.AppendLine("                        if (k > 0.998)")
        sb.AppendLine("                            Minute = '30';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.998 && k > 0.986)")
        sb.AppendLine("                            Minute = '31';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.986 && k > 0.955)")
        sb.AppendLine("                            Minute = '32';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.955 && k > 0.930)")
        sb.AppendLine("                            Minute = '33';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.930 && k > 0.893)")
        sb.AppendLine("                            Minute = '34';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.893 && k > 0.837)")
        sb.AppendLine("                            Minute = '35';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.837 && k > 0.774)")
        sb.AppendLine("                            Minute = '36';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.774 && k > 0.689)")
        sb.AppendLine("                            Minute = '37';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.689 && k > 0.621)")
        sb.AppendLine("                            Minute = '38';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.621 && k > 0.558)")
        sb.AppendLine("                            Minute = '39';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.558 && k > 0.472)")
        sb.AppendLine("                            Minute = '40'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.472 && k > 0.356)")
        sb.AppendLine("                            Minute = '41'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.356 && k > 0.228)")
        sb.AppendLine("                            Minute = '42'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.228 && k > 0.173)")
        sb.AppendLine("                            Minute = '43'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.173 && k > 0.082)")
        sb.AppendLine("                            Minute = '44'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.082)")
        sb.AppendLine("                            Minute = '45'")
        sb.AppendLine("                    }")
        sb.AppendLine("                    if (core == 4) {")
        sb.AppendLine("                        if (k > 0.987)")
        sb.AppendLine("                            v = '00';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.987 && k > 0.922)")
        sb.AppendLine("                            v = '23';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.922 && k > 0.785)")
        sb.AppendLine("                            v = '22';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.785 && k > 0.600)")
        sb.AppendLine("                            v = '21';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.600 && k > 0.374)")
        sb.AppendLine("                            v = '20';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.374 && k > 0.152)")
        sb.AppendLine("                            v = '19';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.152)")
        sb.AppendLine("                            v = '18';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k > 0.998)")
        sb.AppendLine("                            Minute = '30';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.998 && k > 0.986)")
        sb.AppendLine("                            Minute = '29';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.986 && k > 0.955)")
        sb.AppendLine("                            Minute = '28';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.955 && k > 0.930)")
        sb.AppendLine("                            Minute = '27';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.930 && k > 0.893)")
        sb.AppendLine("                            Minute = '26';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.893 && k > 0.837)")
        sb.AppendLine("                            Minute = '25';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.837 && k > 0.774)")
        sb.AppendLine("                            Minute = '24';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.774 && k > 0.689)")
        sb.AppendLine("                            Minute = '23';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.689 && k > 0.621)")
        sb.AppendLine("                            Minute = '22';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.621 && k > 0.558)")
        sb.AppendLine("                            Minute = '21';")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.558 && k > 0.472)")
        sb.AppendLine("                            Minute = '20'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.472 && k > 0.356)")
        sb.AppendLine("                            Minute = '19'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.356 && k > 0.228)")
        sb.AppendLine("                            Minute = '18'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.228 && k > 0.173)")
        sb.AppendLine("                            Minute = '17'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.173 && k > 0.082)")
        sb.AppendLine("                            Minute = '16'")
        sb.AppendLine("")
        sb.AppendLine("                        if (k <= 0.082)")
        sb.AppendLine("                            Minute = '15'")
        sb.AppendLine("                    }")
        sb.AppendLine("                    if (core == 0) {")
        sb.AppendLine("                        if (k == 1) {")
        sb.AppendLine("                            Minute = '15';")
        sb.AppendLine("                        }")
        sb.AppendLine("")
        sb.AppendLine("                        if (k == 0) {")
        sb.AppendLine("                            Minute = '45';")
        sb.AppendLine("                        }")
        sb.AppendLine("                        if (xOriginal < 0) {")
        sb.AppendLine("                            v = '06';")
        sb.AppendLine("                            Minute = '45';")
        sb.AppendLine("                        } else {")
        sb.AppendLine("                            v = '18';")
        sb.AppendLine("                            Minute = '15';")
        sb.AppendLine("                        }")
        sb.AppendLine("")
        sb.AppendLine("                        if (xOriginal == 0 && yOriginal == 0) {")
        sb.AppendLine("                            v = '12';")
        sb.AppendLine("                            Minute = '00';")
        sb.AppendLine("                        }")
        sb.AppendLine("                        if (yOriginal > 0 && xOriginal == 0) {")
        sb.AppendLine("                            v = '00';")
        sb.AppendLine("                            Minute = '30';")
        sb.AppendLine("                        }")
        sb.AppendLine("")
        sb.AppendLine("                        if (xOriginal == 0 && yOriginal < 0) {")
        sb.AppendLine("                            Minute = '00';")
        sb.AppendLine("                            v = '12';")
        sb.AppendLine("")
        sb.AppendLine("                        }")
        sb.AppendLine("                    }")
        sb.AppendLine("                    if (InMinuteRange) {")
        sb.AppendLine("                        $.datetimepicker.DrawMinutes(this, Minute);")
        sb.AppendLine("                    }")
        sb.AppendLine("")
        sb.AppendLine("                    if (InHourRange) {")
        sb.AppendLine("                        $.datetimepicker.DrawHours(this, v);")
        sb.AppendLine("                    }")
        sb.AppendLine("                });")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Changes the Hour hand to the correct image.")
        sb.AppendLine("        t: the Clock instance Div")
        sb.AppendLine("        v: the Hour to set it to.")
        sb.AppendLine("        */")
        sb.AppendLine("        DrawHours: function(t, v) {")
        sb.AppendLine("            var objID = t.id.split(""_"");")
        sb.AppendLine("            var ID = objID[objID.length - 1];")
        sb.AppendLine("            if (parseInt(v) > 12) {")
        sb.AppendLine("                $(""#DP_jQuery_Hour_"" + ID).val(parseInt(v) - 12);")
        sb.AppendLine("                $(""#DP_jQuery_AMPM_"" + ID).val(""PM"");")
        sb.AppendLine("            }")
        sb.AppendLine("            else {")
        sb.AppendLine("                if (v == '00') {")
        sb.AppendLine("                    $(""#DP_jQuery_Hour_"" + ID).val(parseInt('12'));")
        sb.AppendLine("                } else {")
        sb.AppendLine("                    $(""#DP_jQuery_Hour_"" + ID).val(parseInt(v).toString());")
        sb.AppendLine("")
        sb.AppendLine("                    /* I'm lost as to why parseInt can't parse 08 as 8 or 09 as 9 but all the others */")
        sb.AppendLine("                    if (v == '08') {")
        sb.AppendLine("                        $(""#DP_jQuery_Hour_"" + ID).val(""8"");")
        sb.AppendLine("                    }")
        sb.AppendLine("                    if (v == '09') {")
        sb.AppendLine("                        $(""#DP_jQuery_Hour_"" + ID).val(""9"");")
        sb.AppendLine("                    }")
        sb.AppendLine("                }")
        sb.AppendLine("                $(""#DP_jQuery_AMPM_"" + ID).val(""AM"");")
        sb.AppendLine("            }")
        sb.AppendLine("")
        sb.AppendLine("            if (v == '00')")
        sb.AppendLine("                $(""#DP_jQuery_AMPM_"" + ID).val(""AM"");")
        sb.AppendLine("            if (v == '12')")
        sb.AppendLine("                $(""#DP_jQuery_AMPM_"" + ID).val(""PM"");")
        sb.AppendLine("")
        sb.AppendLine("")
        sb.AppendLine("            var HourIndex = v;")
        sb.AppendLine("            if (HourIndex != '12')")
        sb.AppendLine("                HourIndex = HourIndex;")
        sb.AppendLine("            if (HourIndex > 11)")
        sb.AppendLine("                HourIndex = HourIndex - 12;")
        sb.AppendLine("")
        sb.AppendLine("")
        sb.AppendLine("            if (v == 0)")
        sb.AppendLine("                HourIndex = 12;")
        sb.AppendLine("            if (v == 12)")
        sb.AppendLine("                HourIndex = 0;")
        sb.AppendLine("")
        sb.AppendLine("            if (v > 11 || v == 0) {")
        sb.AppendLine("                var IndexLocation = ((HourIndex * 269))")
        sb.AppendLine("                t.children[1].style.backgroundPosition = '0px -' + IndexLocation + 'px';")
        sb.AppendLine("            } else {")
        sb.AppendLine("                HourIndex = Math.abs(12 - HourIndex);")
        sb.AppendLine("                var IndexLocation = ((HourIndex * 269))")
        sb.AppendLine("                t.children[1].style.backgroundPosition = '-269px -' + IndexLocation + 'px';")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Changes the Minute hand to the correct image.")
        sb.AppendLine("        t: the Clock instance Div")
        sb.AppendLine("        Minute: the Minute to set it to.")
        sb.AppendLine("        */")
        sb.AppendLine("        DrawMinutes: function(t, Minute) {")
        sb.AppendLine("            var objID = t.id.split(""_"");")
        sb.AppendLine("            var ID = objID[objID.length - 1];")
        sb.AppendLine("            var Minutes = parseInt(Minute).toString();")
        sb.AppendLine("            $(""#DP_jQuery_Minute_"" + ID).val(parseInt(Minute).toString());")
        sb.AppendLine("")
        sb.AppendLine("            /* I'm lost as to why parseInt can't parse 08 as 8 or 09 as 9 but all the others */")
        sb.AppendLine("            if (Minute == '08')")
        sb.AppendLine("                $(""#DP_jQuery_Minute_"" + ID).val('8');")
        sb.AppendLine("            if (Minute == '09')")
        sb.AppendLine("                $(""#DP_jQuery_Minute_"" + ID).val('9');")
        sb.AppendLine("                ")
        sb.AppendLine("            var ImageIndex = Minute")
        sb.AppendLine("            if (ImageIndex > 30) {")
        sb.AppendLine("                ImageIndex = ImageIndex - 60;")
        sb.AppendLine("                ImageIndex = Math.abs(ImageIndex);")
        sb.AppendLine("                t.children[0].style.backgroundPosition = '-269px -' + (ImageIndex * 269) + 'px';")
        sb.AppendLine("            } else {")
        sb.AppendLine("                t.children[0].style.backgroundPosition = '0px -' + (ImageIndex * 269) + 'px';")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Retrieve the size of left and top borders for an element.")
        sb.AppendLine("        @param  elem  (jQuery object) the element of interest")
        sb.AppendLine("        @return  (number[2]) the left and top borders */")
        sb.AppendLine("        _getBorders: function(elem) {")
        sb.AppendLine("            var convert = function(value) {")
        sb.AppendLine("                return { thin: 1, medium: 2, thick: 3}[value] || value;")
        sb.AppendLine("            };")
        sb.AppendLine("            return [parseFloat(convert(elem.css('border-left-width'))),")
        sb.AppendLine("			parseFloat(convert(elem.css('border-top-width')))];")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Check positioning to remain on screen. */")
        sb.AppendLine("        _checkOffset: function(inst, offset, isFixed) {")
        sb.AppendLine("            var dpWidth = inst.dpDiv.outerWidth();")
        sb.AppendLine("            var dpHeight = inst.dpDiv.outerHeight();")
        sb.AppendLine("            var inputWidth = inst.input ? inst.input.outerWidth() : 0;")
        sb.AppendLine("            var inputHeight = inst.input ? inst.input.outerHeight() : 0;")
        sb.AppendLine("            var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft();")
        sb.AppendLine("            var viewHeight = document.documentElement.clientHeight + $(document).scrollTop();")
        sb.AppendLine("")
        sb.AppendLine("            offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);")
        sb.AppendLine("            offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;")
        sb.AppendLine("            offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;")
        sb.AppendLine("")
        sb.AppendLine("            // now check if datepicker is showing outside window viewport - move to a better place if so.")
        sb.AppendLine("            offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?")
        sb.AppendLine("			Math.abs(offset.left + dpWidth - viewWidth) : 0);")
        sb.AppendLine("            offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?")
        sb.AppendLine("			Math.abs(dpHeight + inputHeight) : 0);")
        sb.AppendLine("")
        sb.AppendLine("            return offset;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        //        /* Find an object's position on the screen. */")
        sb.AppendLine("        //        _findPos: function(obj) {")
        sb.AppendLine("        //            var inst = this._getInst(obj);")
        sb.AppendLine("        //            var isRTL = this._get(inst, 'isRTL');")
        sb.AppendLine("        //            while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {")
        sb.AppendLine("        //                obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];")
        sb.AppendLine("        //            }")
        sb.AppendLine("        //            var position = $(obj).offset();")
        sb.AppendLine("        //            return [position.left, position.top];")
        sb.AppendLine("        //        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Hide the date picker from view.")
        sb.AppendLine("        @param  input  element - the input field attached to the date picker */")
        sb.AppendLine("        _hideDatepicker: function(input) {")
        sb.AppendLine("            var inst = this._curInst;")
        sb.AppendLine("            if (!inst || (input && inst != $.data(input, PROP_NAME)))")
        sb.AppendLine("                return;")
        sb.AppendLine("            if (this._datepickerShowing) {")
        sb.AppendLine("                var showAnim = this._get(inst, 'showAnim');")
        sb.AppendLine("                var duration = this._get(inst, 'duration');")
        sb.AppendLine("                var postProcess = function() {")
        sb.AppendLine("                    $.datetimepicker._tidyDialog(inst);")
        sb.AppendLine("                    this._curInst = null;")
        sb.AppendLine("                };")
        sb.AppendLine("                if ($.effects && $.effects[showAnim])")
        sb.AppendLine("                    inst.dpDiv.hide(showAnim, $.datetimepicker._get(inst, 'showOptions'), duration, postProcess);")
        sb.AppendLine("                else")
        sb.AppendLine("                    inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :")
        sb.AppendLine("					(showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);")
        sb.AppendLine("                if (!showAnim)")
        sb.AppendLine("                    postProcess();")
        sb.AppendLine("                var onClose = this._get(inst, 'onClose');")
        sb.AppendLine("                if (onClose)")
        sb.AppendLine("                    onClose.apply((inst.input ? inst.input[0] : null),")
        sb.AppendLine("					[(inst.input ? inst.input.val() : ''), inst]);  // trigger custom callback")
        sb.AppendLine("                this._datepickerShowing = false;")
        sb.AppendLine("                this._lastInput = null;")
        sb.AppendLine("                if (this._inDialog) {")
        sb.AppendLine("                    this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });")
        sb.AppendLine("                    if ($.blockUI) {")
        sb.AppendLine("                        $.unblockUI();")
        sb.AppendLine("                        $('body').append(this.dpDiv);")
        sb.AppendLine("                    }")
        sb.AppendLine("                }")
        sb.AppendLine("                this._inDialog = false;")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Tidy up after a dialog display. */")
        sb.AppendLine("        _tidyDialog: function(inst) {")
        sb.AppendLine("            inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Close date picker if clicked elsewhere. */")
        sb.AppendLine("        _checkExternalClick: function(event) {")
        sb.AppendLine("            if (!$.datetimepicker._curInst)")
        sb.AppendLine("                return;")
        sb.AppendLine("            var $target = $(event.target);")
        sb.AppendLine("            if ($target[0].id != $.datetimepicker._mainDivId &&")
        sb.AppendLine("				$target.parents('#' + $.datetimepicker._mainDivId).length == 0 &&")
        sb.AppendLine("				!$target.hasClass($.datetimepicker.markerClassName) &&")
        sb.AppendLine("				!$target.hasClass($.datetimepicker._triggerClass) &&")
        sb.AppendLine("				$.datetimepicker._datepickerShowing && !($.datetimepicker._inDialog && $.blockUI))")
        sb.AppendLine("                $.datetimepicker._hideDatepicker();")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Adjust one of the date sub-fields. */")
        sb.AppendLine("        _adjustDate: function(id, offset, period) {")
        sb.AppendLine("")
        sb.AppendLine("            var target = $(id);")
        sb.AppendLine("            var inst = this._getInst(target[0]);")
        sb.AppendLine("            if (this._isDisabledDatepicker(target[0])) {")
        sb.AppendLine("                return;")
        sb.AppendLine("            }")
        sb.AppendLine("            this._adjustInstDate(inst, offset +")
        sb.AppendLine("			(period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning")
        sb.AppendLine("			period);")
        sb.AppendLine("            this._updateDatepicker(inst);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Action for current link. */")
        sb.AppendLine("        _gotoToday: function(id) {")
        sb.AppendLine("            var target = $(id);")
        sb.AppendLine("            var inst = this._getInst(target[0]);")
        sb.AppendLine("            if (this._get(inst, 'gotoCurrent') && inst.currentDay) {")
        sb.AppendLine("                inst.selectedDay = inst.currentDay;")
        sb.AppendLine("                inst.drawMonth = inst.selectedMonth = inst.currentMonth;")
        sb.AppendLine("                inst.drawYear = inst.selectedYear = inst.currentYear;")
        sb.AppendLine("                inst.selectedHour = inst.currentHour;")
        sb.AppendLine("                inst.selectedMinute = inst.currentMinute;")
        sb.AppendLine("                inst.selectedAMPM = inst.currentAMPM;")
        sb.AppendLine("            }")
        sb.AppendLine("            else {")
        sb.AppendLine("                var date = new Date();")
        sb.AppendLine("                inst.selectedDay = date.getDate();")
        sb.AppendLine("                inst.drawMonth = inst.selectedMonth = date.getMonth();")
        sb.AppendLine("                inst.drawYear = inst.selectedYear = date.getFullYear();")
        sb.AppendLine("                if (date.getHours() > 12) {")
        sb.AppendLine("                    inst.selectedHour = date.getHours() - 12;")
        sb.AppendLine("                    inst.selectedAMPM = ""PM"";")
        sb.AppendLine("                }")
        sb.AppendLine("                else {")
        sb.AppendLine("                    inst.selectedHour = date.getHours();")
        sb.AppendLine("                    inst.selectedAMPM = ""AM"";")
        sb.AppendLine("                }")
        sb.AppendLine("")
        sb.AppendLine("                if (date.getHours() == 12) {")
        sb.AppendLine("                    inst.selectedAMPM = ""PM"";")
        sb.AppendLine("                }")
        sb.AppendLine("")
        sb.AppendLine("                if (date.getHours() == 00) {")
        sb.AppendLine("                    inst.selectedHour = 12;")
        sb.AppendLine("                }")
        sb.AppendLine("                inst.selectedMinute = date.getMinutes();")
        sb.AppendLine("            }")
        sb.AppendLine("            this._notifyChange(inst);")
        sb.AppendLine("            this._adjustDate(target);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Action for selecting a new month/year. */")
        sb.AppendLine("        _selectMonthYear: function(id, select, period) {")
        sb.AppendLine("            var target = $(id);")
        sb.AppendLine("            var inst = this._getInst(target[0]);")
        sb.AppendLine("            inst._selectingMonthYear = false;")
        sb.AppendLine("            inst['selected' + (period == 'M' ? 'Month' : 'Year')] =")
        sb.AppendLine("		inst['draw' + (period == 'M' ? 'Month' : 'Year')] =")
        sb.AppendLine("			parseInt(select.options[select.selectedIndex].value, 10);")
        sb.AppendLine("            this._notifyChange(inst);")
        sb.AppendLine("            this._adjustDate(target);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Restore input focus after not changing month/year. */")
        sb.AppendLine("        _clickMonthYear: function(id) {")
        sb.AppendLine("            var target = $(id);")
        sb.AppendLine("            var inst = this._getInst(target[0]);")
        sb.AppendLine("            if (inst.input && inst._selectingMonthYear && !$.browser.msie)")
        sb.AppendLine("                inst.input.focus();")
        sb.AppendLine("            inst._selectingMonthYear = !inst._selectingMonthYear;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Action for selecting a day. */")
        sb.AppendLine("        _selectDay: function(id, month, year, td, hh, mm, am) {")
        sb.AppendLine("            var target = $(id);")
        sb.AppendLine("            if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {")
        sb.AppendLine("                return;")
        sb.AppendLine("            }")
        sb.AppendLine("            var inst = this._getInst(target[0]);")
        sb.AppendLine("            inst.selectedDay = inst.currentDay = $('a', td).html();")
        sb.AppendLine("            inst.selectedMonth = inst.currentMonth = month;")
        sb.AppendLine("            inst.selectedYear = inst.currentYear = year;")
        sb.AppendLine("            inst.selectedHour = inst.currentHour = $(""#DP_jQuery_Hour_"" + dpuuid).val()")
        sb.AppendLine("            inst.selectedMinute = inst.currentMinute = $(""#DP_jQuery_Minute_"" + dpuuid).val();")
        sb.AppendLine("            inst.selectedAMPM = inst.currentAMPM = $(""#DP_jQuery_AMPM_"" + dpuuid).val();")
        sb.AppendLine("            this._selectDate(id, this._formatDate(inst,")
        sb.AppendLine("			inst.currentDay, inst.currentMonth, inst.currentYear));")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Erase the input field and hide the date picker. */")
        sb.AppendLine("        _clearDate: function(id) {")
        sb.AppendLine("            var target = $(id);")
        sb.AppendLine("            var inst = this._getInst(target[0]);")
        sb.AppendLine("            this._selectDate(target, '');")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Update the input field with the selected date. */")
        sb.AppendLine("        _selectDate: function(id, dateStr) {")
        sb.AppendLine("            var target = $(id);")
        sb.AppendLine("            var inst = this._getInst(target[0]);")
        sb.AppendLine("            dateStr = (dateStr != null ? dateStr : this._formatDate(inst));")
        sb.AppendLine("            if (inst.input)")
        sb.AppendLine("                inst.input.val(dateStr);")
        sb.AppendLine("            this._updateAlternate(inst);")
        sb.AppendLine("            var onSelect = this._get(inst, 'onSelect');")
        sb.AppendLine("            if (onSelect)")
        sb.AppendLine("                onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);  // trigger custom callback")
        sb.AppendLine("            else if (inst.input)")
        sb.AppendLine("                inst.input.trigger('change'); // fire the change event")
        sb.AppendLine("            if (inst.inline)")
        sb.AppendLine("                this._updateDatepicker(inst);")
        sb.AppendLine("            else {")
        sb.AppendLine("                this._hideDatepicker();")
        sb.AppendLine("                this._lastInput = inst.input[0];")
        sb.AppendLine("                if (typeof (inst.input[0]) != 'object')")
        sb.AppendLine("                    inst.input.focus(); // restore focus")
        sb.AppendLine("                this._lastInput = null;")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Update any alternate field to synchronise with the main field. */")
        sb.AppendLine("        _updateAlternate: function(inst) {")
        sb.AppendLine("            var altField = this._get(inst, 'altField');")
        sb.AppendLine("            if (altField) { // update alternate field too")
        sb.AppendLine("                var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');")
        sb.AppendLine("                var date = this._getDate(inst);")
        sb.AppendLine("                var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));")
        sb.AppendLine("                $(altField).each(function() { $(this).val(dateStr); });")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Set as beforeShowDay function to prevent selection of weekends.")
        sb.AppendLine("        @param  date  Date - the date to customise")
        sb.AppendLine("        @return [boolean, string] - is this date selectable?, what is its CSS class? */")
        sb.AppendLine("        noWeekends: function(date) {")
        sb.AppendLine("            var day = date.getDay();")
        sb.AppendLine("            return [(day > 0 && day < 6), ''];")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.")
        sb.AppendLine("        @param  date  Date - the date to get the week for")
        sb.AppendLine("        @return  number - the number of the week within the year that contains this date */")
        sb.AppendLine("        iso8601Week: function(date) {")
        sb.AppendLine("            var checkDate = new Date(date.getTime());")
        sb.AppendLine("            // Find Thursday of this week starting on Monday")
        sb.AppendLine("            checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));")
        sb.AppendLine("            var time = checkDate.getTime();")
        sb.AppendLine("            checkDate.setMonth(0); // Compare with Jan 1")
        sb.AppendLine("            checkDate.setDate(1);")
        sb.AppendLine("            return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Parse a string value into a date object.")
        sb.AppendLine("        See formatDate below for the possible formats.")
        sb.AppendLine("")
        sb.AppendLine("	   @param  format    string - the expected format of the date")
        sb.AppendLine("        @param  value     string - the date in the above format")
        sb.AppendLine("        @param  settings  Object - attributes include:")
        sb.AppendLine("        shortYearCutoff  number - the cutoff year for determining the century (optional)")
        sb.AppendLine("        dayNamesShort    string[7] - abbreviated names of the days from Sunday (optional)")
        sb.AppendLine("        dayNames         string[7] - names of the days from Sunday (optional)")
        sb.AppendLine("        monthNamesShort  string[12] - abbreviated names of the months (optional)")
        sb.AppendLine("        monthNames       string[12] - names of the months (optional)")
        sb.AppendLine("        @return  Date - the extracted date value or null if value is blank */")
        sb.AppendLine("        parseDate: function(format, value, settings) {")
        sb.AppendLine("            if (format == null || value == null)")
        sb.AppendLine("                throw 'Invalid arguments';")
        sb.AppendLine("            value = (typeof value == 'object' ? value.toString() : value + '');")
        sb.AppendLine("            if (value == '')")
        sb.AppendLine("                return null;")
        sb.AppendLine("")
        sb.AppendLine("            var dte = new Date(value);")
        sb.AppendLine("            //            dte.setYear(this._DetermineYear(dte.getFullYear()));")
        sb.AppendLine("            dte.setYear(this._DetermineYear(dte.getYear()));")
        sb.AppendLine("")
        sb.AppendLine("            if (dte == ""NaN"") {")
        sb.AppendLine("                return null;")
        sb.AppendLine("            } else {")
        sb.AppendLine("                return dte;")
        sb.AppendLine("            }")
        sb.AppendLine("            return null;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("")
        sb.AppendLine("")
        sb.AppendLine("        /* Format a date object into a string value.")
        sb.AppendLine("")
        sb.AppendLine("	    @param   format    see formating")
        sb.AppendLine("        @param   date      Date - the date value to format")
        sb.AppendLine("        @Param   settings igonred")
        sb.AppendLine("        @return  string - the date in the above format ")
        sb.AppendLine("        ")
        sb.AppendLine("        d Day of the month as digits; no leading zero for single-digit days. ")
        sb.AppendLine("        */")
        sb.AppendLine("        formatDate: function(format, date, settings) {")
        sb.AppendLine("            if (!date)")
        sb.AppendLine("                return '';")
        sb.AppendLine("            return date.format(format);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Extract all possible characters from the date format. */")
        sb.AppendLine("        _possibleChars: function(format) {")
        sb.AppendLine("            var chars = '';")
        sb.AppendLine("            var literal = false;")
        sb.AppendLine("            // Check whether a format character is doubled")
        sb.AppendLine("            var lookAhead = function(match) {")
        sb.AppendLine("                var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);")
        sb.AppendLine("                if (matches)")
        sb.AppendLine("                    iFormat++;")
        sb.AppendLine("                return matches;")
        sb.AppendLine("            };")
        sb.AppendLine("            for (var iFormat = 0; iFormat < format.length; iFormat++)")
        sb.AppendLine("                if (literal)")
        sb.AppendLine("                if (format.charAt(iFormat) == ""'"" && !lookAhead(""'""))")
        sb.AppendLine("                literal = false;")
        sb.AppendLine("            else")
        sb.AppendLine("                chars += format.charAt(iFormat);")
        sb.AppendLine("            else")
        sb.AppendLine("                switch (format.charAt(iFormat)) {")
        sb.AppendLine("                case 'd': case 'm': case 'y': case '@':")
        sb.AppendLine("                    chars += '0123456789';")
        sb.AppendLine("                    break;")
        sb.AppendLine("                case 'D': case 'M':")
        sb.AppendLine("                    return null; // Accept anything")
        sb.AppendLine("                case ""'"":")
        sb.AppendLine("                    if (lookAhead(""'""))")
        sb.AppendLine("                        chars += ""'"";")
        sb.AppendLine("                    else")
        sb.AppendLine("                        literal = true;")
        sb.AppendLine("                    break;")
        sb.AppendLine("                default:")
        sb.AppendLine("                    chars += format.charAt(iFormat);")
        sb.AppendLine("            }")
        sb.AppendLine("            return chars;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Get a setting value, defaulting if necessary. */")
        sb.AppendLine("        _get: function(inst, name) {")
        sb.AppendLine("            return inst.settings[name] !== undefined ?")
        sb.AppendLine("			inst.settings[name] : this._defaults[name];")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Parse existing date and initialise date picker. */")
        sb.AppendLine("        _setDateFromField: function(inst, noDefault) {")
        sb.AppendLine("            if (inst.input.val() == inst.lastVal) {")
        sb.AppendLine("                return;")
        sb.AppendLine("            }")
        sb.AppendLine("            var dateFormat = this._get(inst, 'dateFormat');")
        sb.AppendLine("            var dates = inst.lastVal = inst.input ? inst.input.val() : null;")
        sb.AppendLine("            var date, defaultDate;")
        sb.AppendLine("            date = defaultDate = this._getDefaultDate(inst);")
        sb.AppendLine("            var settings = this._getFormatConfig(inst);")
        sb.AppendLine("            try {")
        sb.AppendLine("                date = this.parseDate(dateFormat, dates, settings) || defaultDate;")
        sb.AppendLine("            } catch (event) {")
        sb.AppendLine("                this.log(event);")
        sb.AppendLine("                dates = (noDefault ? '' : dates);")
        sb.AppendLine("            }")
        sb.AppendLine("            inst.selectedDay = date.getDate();")
        sb.AppendLine("            inst.drawMonth = inst.selectedMonth = date.getMonth();")
        sb.AppendLine("            inst.drawYear = inst.selectedYear = $.datetimepicker._DetermineYear(date.getYear());")
        sb.AppendLine("            //            inst.drawYear = inst.selectedYear = date.getFullYear();")
        sb.AppendLine("            inst.currentDay = (dates ? date.getDate() : 0);")
        sb.AppendLine("            inst.currentMonth = (dates ? date.getMonth() : 0);")
        sb.AppendLine("            if (!dates)")
        sb.AppendLine("                dates = date;")
        sb.AppendLine("")
        sb.AppendLine("            if (date.getHours() > 12) {")
        sb.AppendLine("                inst.currentHour = date.getHours() - 12;")
        sb.AppendLine("                inst.currentAMPM = ""PM"";")
        sb.AppendLine("            }")
        sb.AppendLine("            else {")
        sb.AppendLine("                inst.currentHour = date.getHours();")
        sb.AppendLine("                inst.currentAMPM = ""AM"";")
        sb.AppendLine("            }")
        sb.AppendLine("")
        sb.AppendLine("            if (date.getHours() == 12) {")
        sb.AppendLine("                inst.currentAMPM = ""PM"";")
        sb.AppendLine("            }")
        sb.AppendLine("")
        sb.AppendLine("            if (date.getHours() == 00) {")
        sb.AppendLine("                inst.currentHour = 12;")
        sb.AppendLine("            }")
        sb.AppendLine("")
        sb.AppendLine("            inst.currentMinute = date.getMinutes();")
        sb.AppendLine("")
        sb.AppendLine("            //inst.currentYear = (dates ? date.getFullYear() : 0);")
        sb.AppendLine("            inst.currentYear = (dates ? $.datetimepicker._DetermineYear(date.getYear()) : 0);")
        sb.AppendLine("            this._adjustInstDate(inst);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Retrieve the default date shown on opening. */")
        sb.AppendLine("        _getDefaultDate: function(inst) {")
        sb.AppendLine("            return this._restrictMinMax(inst,")
        sb.AppendLine("			this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* A date may be specified as an exact value or a relative one. */")
        sb.AppendLine("        _determineDate: function(inst, date, defaultDate) {")
        sb.AppendLine("            var offsetNumeric = function(offset) {")
        sb.AppendLine("                var date = new Date();")
        sb.AppendLine("                date.setDate(date.getDate() + offset);")
        sb.AppendLine("                return date;")
        sb.AppendLine("            };")
        sb.AppendLine("            var offsetString = function(offset) {")
        sb.AppendLine("                try {")
        sb.AppendLine("                    return $.datetimepicker.parseDate($.datetimepicker._get(inst, 'dateFormat'),")
        sb.AppendLine("					offset, $.datetimepicker._getFormatConfig(inst));")
        sb.AppendLine("                }")
        sb.AppendLine("                catch (e) {")
        sb.AppendLine("                    // Ignore")
        sb.AppendLine("                }")
        sb.AppendLine("                var date = (offset.toLowerCase().match(/^c/) ?")
        sb.AppendLine("				$.datetimepicker._getDate(inst) : null) || new Date();")
        sb.AppendLine("                //var year = date.getFullYear();")
        sb.AppendLine("                var year = $.datetimepicker._DetermineYear(date.getYear());")
        sb.AppendLine("                var month = date.getMonth();")
        sb.AppendLine("                var day = date.getDate();")
        sb.AppendLine("                var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;")
        sb.AppendLine("                var matches = pattern.exec(offset);")
        sb.AppendLine("                while (matches) {")
        sb.AppendLine("                    switch (matches[2] || 'd') {")
        sb.AppendLine("                        case 'd': case 'D':")
        sb.AppendLine("                            day += parseInt(matches[1], 10); break;")
        sb.AppendLine("                        case 'w': case 'W':")
        sb.AppendLine("                            day += parseInt(matches[1], 10) * 7; break;")
        sb.AppendLine("                        case 'm': case 'M':")
        sb.AppendLine("                            month += parseInt(matches[1], 10);")
        sb.AppendLine("                            day = Math.min(day, $.datetimepicker._getDaysInMonth(year, month));")
        sb.AppendLine("                            break;")
        sb.AppendLine("                        case 'y': case 'Y':")
        sb.AppendLine("                            year += parseInt(matches[1], 10);")
        sb.AppendLine("                            day = Math.min(day, $.datetimepicker._getDaysInMonth(year, month));")
        sb.AppendLine("                            break;")
        sb.AppendLine("                    }")
        sb.AppendLine("                    matches = pattern.exec(offset);")
        sb.AppendLine("                }")
        sb.AppendLine("                return new Date(year, month, day);")
        sb.AppendLine("            };")
        sb.AppendLine("            date = (date == null ? defaultDate : (typeof date == 'string' ? offsetString(date) :")
        sb.AppendLine("			(typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date)));")
        sb.AppendLine("            date = (date && date.toString() == 'Invalid Date' ? defaultDate : date);")
        sb.AppendLine("            /////////////////////=^..^=")
        sb.AppendLine("            //            if (date) {")
        sb.AppendLine("            //                date.setHours(0);")
        sb.AppendLine("            //                date.setMinutes(0);")
        sb.AppendLine("            //                date.setSeconds(0);")
        sb.AppendLine("            //                date.setMilliseconds(0);")
        sb.AppendLine("            //            }")
        sb.AppendLine("            return this._daylightSavingAdjust(date);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Handle switch to/from daylight saving.")
        sb.AppendLine("        Hours may be non-zero on daylight saving cut-over:")
        sb.AppendLine("        > 12 when midnight changeover, but then cannot generate")
        sb.AppendLine("        midnight datetime, so jump to 1AM, otherwise reset.")
        sb.AppendLine("        @param  date  (Date) the date to check")
        sb.AppendLine("        @return  (Date) the corrected date */")
        sb.AppendLine("        _daylightSavingAdjust: function(date) {")
        sb.AppendLine("            if (!date) return null;")
        sb.AppendLine("            //////////////////////////=^..^=")
        sb.AppendLine("            //date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);")
        sb.AppendLine("            return date;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Set the date(s) directly. */")
        sb.AppendLine("        _setDate: function(inst, date, noChange) {")
        sb.AppendLine("            var clear = !(date);")
        sb.AppendLine("            var origMonth = inst.selectedMonth;")
        sb.AppendLine("            var origYear = inst.selectedYear;")
        sb.AppendLine("            date = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));")
        sb.AppendLine("            inst.selectedDay = inst.currentDay = date.getDate();")
        sb.AppendLine("            inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();")
        sb.AppendLine("            //            inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();")
        sb.AppendLine("            inst.drawYear = inst.selectedYear = inst.currentYear = $.datetimepicker._DetermineYear(date.getYear());")
        sb.AppendLine("            if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)")
        sb.AppendLine("                this._notifyChange(inst);")
        sb.AppendLine("            this._adjustInstDate(inst);")
        sb.AppendLine("            if (inst.input) {")
        sb.AppendLine("                inst.input.val(clear ? '' : this._formatDate(inst));")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Retrieve the date(s) directly. */")
        sb.AppendLine("        _getDate: function(inst) {")
        sb.AppendLine("            var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :")
        sb.AppendLine("			this._daylightSavingAdjust(new Date(")
        sb.AppendLine("			inst.currentYear, inst.currentMonth, inst.currentDay)));")
        sb.AppendLine("            return startDate;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Generate the HTML for the current state of the date picker. */")
        sb.AppendLine("        _generateHTML: function(inst) {")
        sb.AppendLine("")
        sb.AppendLine("            var show24HourClock = this._get(inst, 'show24HourClock');")
        sb.AppendLine("            if (show24HourClock)")
        sb.AppendLine("                this.dpDiv.addClass('ui-datetimepicker-with-clock');")
        sb.AppendLine("            var today = new Date();")
        sb.AppendLine("            today = this._daylightSavingAdjust(")
        sb.AppendLine("			new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time")
        sb.AppendLine("            var isRTL = this._get(inst, 'isRTL');")
        sb.AppendLine("            var showButtonPanel = this._get(inst, 'showButtonPanel');")
        sb.AppendLine("            var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');")
        sb.AppendLine("            var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');")
        sb.AppendLine("            var numMonths = this._getNumberOfMonths(inst);")
        sb.AppendLine("            var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');")
        sb.AppendLine("            var stepMonths = this._get(inst, 'stepMonths');")
        sb.AppendLine("            var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);")
        sb.AppendLine("            var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :")
        sb.AppendLine("			new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));")
        sb.AppendLine("")
        sb.AppendLine("            var minDate = this._getMinMaxDate(inst, 'min');")
        sb.AppendLine("            var maxDate = this._getMinMaxDate(inst, 'max');")
        sb.AppendLine("            var drawMonth = inst.drawMonth - showCurrentAtPos;")
        sb.AppendLine("            var drawYear = inst.drawYear;")
        sb.AppendLine("            if (drawMonth < 0) {")
        sb.AppendLine("                drawMonth += 12;")
        sb.AppendLine("                drawYear--;")
        sb.AppendLine("            }")
        sb.AppendLine("            if (maxDate) {")
        sb.AppendLine("                var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),")
        sb.AppendLine("				maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));")
        sb.AppendLine("                maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);")
        sb.AppendLine("                //while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {")
        sb.AppendLine("")
        sb.AppendLine("                while (this._daylightSavingAdjust(new Date($.datetimepicker._DetermineYear(drawYear), drawMonth, 1)) > maxDraw) {")
        sb.AppendLine("                    drawMonth--;")
        sb.AppendLine("                    if (drawMonth < 0) {")
        sb.AppendLine("                        drawMonth = 11;")
        sb.AppendLine("                        drawYear--;")
        sb.AppendLine("                    }")
        sb.AppendLine("                }")
        sb.AppendLine("            }")
        sb.AppendLine("            inst.drawMonth = drawMonth;")
        sb.AppendLine("            inst.drawYear = drawYear;")
        sb.AppendLine("            var prevText = this._get(inst, 'prevText');")
        sb.AppendLine("            prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,")
        sb.AppendLine("			this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),")
        sb.AppendLine("			this._getFormatConfig(inst)));")
        sb.AppendLine("            var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?")
        sb.AppendLine("			'<a class=""ui-datepicker-prev ui-corner-all"" onclick=""DP_jQuery_' + dpuuid +")
        sb.AppendLine("			'.datetimepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');""' +")
        sb.AppendLine("			' title=""' + prevText + '""><span class=""ui-icon ui-icon-circle-triangle-' + (isRTL ? 'e' : 'w') + '"">' + prevText + '</span></a>' :")
        sb.AppendLine("			(hideIfNoPrevNext ? '' : '<a class=""ui-datepicker-prev ui-corner-all ui-state-disabled"" title=""' + prevText + '""><span class=""ui-icon ui-icon-circle-triangle-' + (isRTL ? 'e' : 'w') + '"">' + prevText + '</span></a>'));")
        sb.AppendLine("            var nextText = this._get(inst, 'nextText');")
        sb.AppendLine("            nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,")
        sb.AppendLine("			this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),")
        sb.AppendLine("			this._getFormatConfig(inst)));")
        sb.AppendLine("            var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?")
        sb.AppendLine("			'<a class=""ui-datepicker-next ui-corner-all"" onclick=""DP_jQuery_' + dpuuid +")
        sb.AppendLine("			'.datetimepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');""' +")
        sb.AppendLine("			' title=""' + nextText + '""><span class=""ui-icon ui-icon-circle-triangle-' + (isRTL ? 'w' : 'e') + '"">' + nextText + '</span></a>' :")
        sb.AppendLine("			(hideIfNoPrevNext ? '' : '<a class=""ui-datepicker-next ui-corner-all ui-state-disabled"" title=""' + nextText + '""><span class=""ui-icon ui-icon-circle-triangle-' + (isRTL ? 'w' : 'e') + '"">' + nextText + '</span></a>'));")
        sb.AppendLine("            var currentText = this._get(inst, 'currentText');")
        sb.AppendLine("            var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);")
        sb.AppendLine("            currentText = (!navigationAsDateFormat ? currentText :")
        sb.AppendLine("			this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));")
        sb.AppendLine("            var controls = (!inst.inline ? '<button type=""button"" class=""ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all"" onclick=""DP_jQuery_' + dpuuid +")
        sb.AppendLine("			'.datetimepicker._hideDatepicker();"">' + this._get(inst, 'closeText') + '</button>' : '');")
        sb.AppendLine("            var buttonPanel = (showButtonPanel) ? '<div class=""ui-datepicker-buttonpane ui-widget-content"">' + (isRTL ? controls : '') +")
        sb.AppendLine("			(this._isInRange(inst, gotoDate) ? '<button type=""button"" class=""ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all"" onclick=""DP_jQuery_' + dpuuid +")
        sb.AppendLine("			'.datetimepicker._gotoToday(\'#' + inst.id + '\');""' +")
        sb.AppendLine("			'>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';")
        sb.AppendLine("            var firstDay = parseInt(this._get(inst, 'firstDay'), 10);")
        sb.AppendLine("            firstDay = (isNaN(firstDay) ? 0 : firstDay);")
        sb.AppendLine("            var showWeek = this._get(inst, 'showWeek');")
        sb.AppendLine("            var dayNames = this._get(inst, 'dayNames');")
        sb.AppendLine("            var dayNamesShort = this._get(inst, 'dayNamesShort');")
        sb.AppendLine("            var dayNamesMin = this._get(inst, 'dayNamesMin');")
        sb.AppendLine("            var monthNames = this._get(inst, 'monthNames');")
        sb.AppendLine("            var monthNamesShort = this._get(inst, 'monthNamesShort');")
        sb.AppendLine("            var beforeShowDay = this._get(inst, 'beforeShowDay');")
        sb.AppendLine("            var showOtherMonths = this._get(inst, 'showOtherMonths');")
        sb.AppendLine("            var selectOtherMonths = this._get(inst, 'selectOtherMonths');")
        sb.AppendLine("            var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;")
        sb.AppendLine("            var defaultDate = this._getDefaultDate(inst);")
        sb.AppendLine("            var html = '';")
        sb.AppendLine("            for (var row = 0; row < numMonths[0]; row++) {")
        sb.AppendLine("                var group = '';")
        sb.AppendLine("                for (var col = 0; col < numMonths[1]; col++) {")
        sb.AppendLine("                    var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));")
        sb.AppendLine("                    var cornerClass = ' ui-corner-all';")
        sb.AppendLine("                    var calender = '';")
        sb.AppendLine("                    if (isMultiMonth) {")
        sb.AppendLine("                        calender += '<div class=""ui-datepicker-group';")
        sb.AppendLine("                        if (numMonths[1] > 1)")
        sb.AppendLine("                            switch (col) {")
        sb.AppendLine("                            case 0: calender += ' ui-datepicker-group-first';")
        sb.AppendLine("                                cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;")
        sb.AppendLine("                            case numMonths[1] - 1: calender += ' ui-datepicker-group-last';")
        sb.AppendLine("                                cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;")
        sb.AppendLine("                            default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;")
        sb.AppendLine("                        }")
        sb.AppendLine("                        calender += '"">';")
        sb.AppendLine("                    }")
        sb.AppendLine("                    if (show24HourClock)")
        sb.AppendLine("                        calender += '<div class=""ui-datetimepicker-calendar-side"">';")
        sb.AppendLine("                    calender += '<div class=""ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '"">' +")
        sb.AppendLine("					(/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +")
        sb.AppendLine("					(/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +")
        sb.AppendLine("					this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,")
        sb.AppendLine("					row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers")
        sb.AppendLine("					'</div><table class=""ui-datepicker-calendar""><thead>' +")
        sb.AppendLine("					'<tr>';")
        sb.AppendLine("                    var thead = (showWeek ? '<th class=""ui-datepicker-week-col"">' + this._get(inst, 'weekHeader') + '</th>' : '');")
        sb.AppendLine("                    for (var dow = 0; dow < 7; dow++) { // days of the week")
        sb.AppendLine("                        var day = (dow + firstDay) % 7;")
        sb.AppendLine("                        thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class=""ui-datepicker-week-end""' : '') + '>' +")
        sb.AppendLine("						'<span title=""' + dayNames[day] + '"">' + dayNamesMin[day] + '</span></th>';")
        sb.AppendLine("                    }")
        sb.AppendLine("                    calender += thead + '</tr></thead><tbody>';")
        sb.AppendLine("                    var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);")
        sb.AppendLine("                    if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)")
        sb.AppendLine("                        inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);")
        sb.AppendLine("                    var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;")
        sb.AppendLine("                    var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate")
        sb.AppendLine("                    var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));")
        sb.AppendLine("                    for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows")
        sb.AppendLine("                        calender += '<tr>';")
        sb.AppendLine("                        var tbody = (!showWeek ? '' : '<td class=""ui-datepicker-week-col"">' +")
        sb.AppendLine("						this._get(inst, 'calculateWeek')(printDate) + '</td>');")
        sb.AppendLine("                        for (var dow = 0; dow < 7; dow++) { // create date picker days")
        sb.AppendLine("                            var daySettings = (beforeShowDay ?")
        sb.AppendLine("							beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);")
        sb.AppendLine("                            var otherMonth = (printDate.getMonth() != drawMonth);")
        sb.AppendLine("                            var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||")
        sb.AppendLine("							(minDate && printDate < minDate) || (maxDate && printDate > maxDate);")
        sb.AppendLine("                            tbody += '<td class=""' +")
        sb.AppendLine("							((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends")
        sb.AppendLine("							(otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months")
        sb.AppendLine("							((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key")
        sb.AppendLine("							(defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?")
        sb.AppendLine("                            // or defaultDate is current printedDate and defaultDate is selectedDate")
        sb.AppendLine("							' ' + this._dayOverClass : '') + // highlight selected day")
        sb.AppendLine("							(unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled' : '') +  // highlight unselectable days")
        sb.AppendLine("							(otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates")
        sb.AppendLine("							(printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day")
        sb.AppendLine("							(printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '""' + // highlight today (if different)")
        sb.AppendLine("							((!otherMonth || showOtherMonths) && daySettings[2] ? ' title=""' + daySettings[2] + '""' : '') + // cell title")
        sb.AppendLine("							(unselectable ? '' : ' onclick=""DP_jQuery_' + dpuuid + '.datetimepicker._selectDay(\'#' +")
        sb.AppendLine("							inst.id + '\',' + printDate.getMonth() + ',' + printDate.getFullYear() + ', this);return false;""') + '>' + // actions")
        sb.AppendLine("							(otherMonth && !showOtherMonths ? '&#xa0;' : // display for other months")
        sb.AppendLine("							(unselectable ? '<span class=""ui-state-default"">' + printDate.getDate() + '</span>' : '<a class=""ui-state-default' +")
        sb.AppendLine("							(printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +")
        sb.AppendLine("							(printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day")
        sb.AppendLine("							(otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months")
        sb.AppendLine("							'"" href=""#"">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date")
        sb.AppendLine("                            printDate.setDate(printDate.getDate() + 1);")
        sb.AppendLine("                            printDate = this._daylightSavingAdjust(printDate);")
        sb.AppendLine("                        }")
        sb.AppendLine("                        calender += tbody + '</tr>';")
        sb.AppendLine("")
        sb.AppendLine("                    }")
        sb.AppendLine("                    drawMonth++;")
        sb.AppendLine("                    if (drawMonth > 11) {")
        sb.AppendLine("                        drawMonth = 0;")
        sb.AppendLine("                        drawYear++;")
        sb.AppendLine("                    }")
        sb.AppendLine("                    calender += '</tbody></table>' + (isMultiMonth ? '</div>' +")
        sb.AppendLine("							((numMonths[0] > 0 && col == numMonths[1] - 1) ? '<div class=""ui-datepicker-row-break""></div>' : '') : '');")
        sb.AppendLine("")
        sb.AppendLine("                    group += calender;")
        sb.AppendLine("                }")
        sb.AppendLine("")
        sb.AppendLine("                html += group;")
        sb.AppendLine("")
        sb.AppendLine("                // Hour Drop Down")
        sb.AppendLine("                html += 'Time <select id=""DP_jQuery_Hour_' + dpuuid + '"">';")
        sb.AppendLine("                for (i = 1; i < 13; i++) {")
        sb.AppendLine("                    html += '<option value=""' + i + '""';")
        sb.AppendLine("")
        sb.AppendLine("                    if (inst.currentHour == i) {")
        sb.AppendLine("                        html += ' selected ';")
        sb.AppendLine("                    }")
        sb.AppendLine("")
        sb.AppendLine("                    html += '>';")
        sb.AppendLine("                    if (i < 10) {")
        sb.AppendLine("                        html += '0';")
        sb.AppendLine("                    }")
        sb.AppendLine("                    html += i + '</option>';")
        sb.AppendLine("                }")
        sb.AppendLine("")
        sb.AppendLine("                html += '</select>';")
        sb.AppendLine("")
        sb.AppendLine("                // Minute Drop Down")
        sb.AppendLine("                var MinuteHTML;")
        sb.AppendLine("                MinuteHTML = '';")
        sb.AppendLine("                MinuteHTML += '&nbsp;: <select id=""DP_jQuery_Minute_' + dpuuid + '"">';")
        sb.AppendLine("")
        sb.AppendLine("                for (i = 0; i < 60; i++) {")
        sb.AppendLine("")
        sb.AppendLine("                    MinuteHTML += '<option ';")
        sb.AppendLine("                    if (inst.currentMinute == i) {")
        sb.AppendLine("                        MinuteHTML += ' selected ';")
        sb.AppendLine("                    }")
        sb.AppendLine("                    MinuteHTML += 'value=""' + i + '""';")
        sb.AppendLine("                    MinuteHTML += '>';")
        sb.AppendLine("                    if (i < 10) {")
        sb.AppendLine("                        MinuteHTML += '0';")
        sb.AppendLine("                    }")
        sb.AppendLine("                    MinuteHTML += i + '</option>';")
        sb.AppendLine("                }")
        sb.AppendLine("                MinuteHTML += '</select>';")
        sb.AppendLine("                html += MinuteHTML;")
        sb.AppendLine("")
        sb.AppendLine("                //AM/PM drop Down")
        sb.AppendLine("                html += ' <select id=""DP_jQuery_AMPM_' + dpuuid + '""><option value=""AM""';")
        sb.AppendLine("                if (inst.currentAMPM == ""AM"")")
        sb.AppendLine("                    html += ' selected ';")
        sb.AppendLine("                html += '>AM</option><option value=""PM""';")
        sb.AppendLine("                if (inst.currentAMPM == ""PM"")")
        sb.AppendLine("                    html += ' selected ';")
        sb.AppendLine("                html += '>PM</option></select>';")
        sb.AppendLine("            }")
        sb.AppendLine("")
        sb.AppendLine("            if (show24HourClock) {")
        sb.AppendLine("                html += '</div>';")
        sb.AppendLine("                html += '<div class=""ui-datetimepicker-clock"" id=""DP_jQuery_clock_' + dpuuid + '"" >';")
        sb.AppendLine("                html += '    <div id=""DP_jQuery_Minute_' + dpuuid + '"" class=""ui-datetimepicker-clock-minute-hand""></div>';")
        sb.AppendLine("                html += '    <div id=""DP_jQuery_Hour_' + dpuuid + '"" class=""ui-datetimepicker-clock-hour-hand""></div>';")
        sb.AppendLine("                html += '    <div id=""DP_jQuery_Minute_Overlay_' + dpuuid + '"" class=""ui-datetimepicker-clock-minute-overlay"" style=""display:none""></div>';")
        sb.AppendLine("                html += '    <div id=""DP_jQuery_Hour_Overlay_' + dpuuid + '"" class=""ui-datetimepicker-clock-hour-overlay"" style=""display:none""></div>';")
        sb.AppendLine("                html += '</div>';")
        sb.AppendLine("            }")
        sb.AppendLine("")
        sb.AppendLine("            html += buttonPanel + ($.browser.msie && parseInt($.browser.version, 10) < 7 && !inst.inline ?")
        sb.AppendLine("			'<iframe src=""javascript:false;"" class=""ui-datepicker-cover"" frameborder=""0""></iframe>' : '');")
        sb.AppendLine("            inst._keyEvent = false;")
        sb.AppendLine("            return html;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Generate the month and year header. */")
        sb.AppendLine("        _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,")
        sb.AppendLine("			secondary, monthNames, monthNamesShort) {")
        sb.AppendLine("            var changeMonth = this._get(inst, 'changeMonth');")
        sb.AppendLine("            var changeYear = this._get(inst, 'changeYear');")
        sb.AppendLine("            var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');")
        sb.AppendLine("            var html = '<div class=""ui-datepicker-title"">';")
        sb.AppendLine("            var monthHtml = '';")
        sb.AppendLine("            // month selection")
        sb.AppendLine("            if (secondary || !changeMonth)")
        sb.AppendLine("                monthHtml += '<span class=""ui-datepicker-month"">' + monthNames[drawMonth] + '</span>';")
        sb.AppendLine("            else {")
        sb.AppendLine("                var inMinYear = (minDate && minDate.getFullYear() == drawYear);")
        sb.AppendLine("                var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);")
        sb.AppendLine("                monthHtml += '<select class=""ui-datepicker-month"" ' +")
        sb.AppendLine("				'onchange=""DP_jQuery_' + dpuuid + '.datetimepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');"" ' +")
        sb.AppendLine("				'onclick=""DP_jQuery_' + dpuuid + '.datetimepicker._clickMonthYear(\'#' + inst.id + '\');""' +")
        sb.AppendLine("			 	'>';")
        sb.AppendLine("                for (var month = 0; month < 12; month++) {")
        sb.AppendLine("                    if ((!inMinYear || month >= minDate.getMonth()) &&")
        sb.AppendLine("						(!inMaxYear || month <= maxDate.getMonth()))")
        sb.AppendLine("                        monthHtml += '<option value=""' + month + '""' +")
        sb.AppendLine("						(month == drawMonth ? ' selected=""selected""' : '') +")
        sb.AppendLine("						'>' + monthNamesShort[month] + '</option>';")
        sb.AppendLine("                }")
        sb.AppendLine("                monthHtml += '</select>';")
        sb.AppendLine("            }")
        sb.AppendLine("            if (!showMonthAfterYear)")
        sb.AppendLine("                html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');")
        sb.AppendLine("            // year selection")
        sb.AppendLine("            if (secondary || !changeYear)")
        sb.AppendLine("                html += '<span class=""ui-datepicker-year"">' + drawYear + '</span>';")
        sb.AppendLine("            else {")
        sb.AppendLine("                // determine range of years to display")
        sb.AppendLine("                var years = this._get(inst, 'yearRange').split(':');")
        sb.AppendLine("                var thisYear = new Date().getFullYear();")
        sb.AppendLine("                var determineYear = function(value) {")
        sb.AppendLine("                    var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :")
        sb.AppendLine("					(value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :")
        sb.AppendLine("					parseInt(value, 10)));")
        sb.AppendLine("                    return (isNaN(year) ? thisYear : year);")
        sb.AppendLine("                };")
        sb.AppendLine("                var year = determineYear(years[0]);")
        sb.AppendLine("                var endYear = Math.max(year, determineYear(years[1] || ''));")
        sb.AppendLine("                year = (minDate ? Math.max(year, minDate.getFullYear()) : year);")
        sb.AppendLine("                endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);")
        sb.AppendLine("                html += '<select class=""ui-datepicker-year"" ' +")
        sb.AppendLine("				'onchange=""DP_jQuery_' + dpuuid + '.datetimepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');"" ' +")
        sb.AppendLine("				'onclick=""DP_jQuery_' + dpuuid + '.datetimepicker._clickMonthYear(\'#' + inst.id + '\');""' +")
        sb.AppendLine("				'>';")
        sb.AppendLine("                for (; year <= endYear; year++) {")
        sb.AppendLine("                    html += '<option value=""' + year + '""' +")
        sb.AppendLine("					(year == drawYear ? ' selected=""selected""' : '') +")
        sb.AppendLine("					'>' + year + '</option>';")
        sb.AppendLine("                }")
        sb.AppendLine("                html += '</select>';")
        sb.AppendLine("            }")
        sb.AppendLine("            html += this._get(inst, 'yearSuffix');")
        sb.AppendLine("            if (showMonthAfterYear)")
        sb.AppendLine("                html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml;")
        sb.AppendLine("            html += '</div>'; // Close datepicker_header")
        sb.AppendLine("            return html;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Adjust one of the date sub-fields. */")
        sb.AppendLine("        _adjustInstDate: function(inst, offset, period) {")
        sb.AppendLine("            var year = inst.drawYear + (period == 'Y' ? offset : 0);")
        sb.AppendLine("            var month = inst.drawMonth + (period == 'M' ? offset : 0);")
        sb.AppendLine("            var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +")
        sb.AppendLine("			(period == 'D' ? offset : 0);")
        sb.AppendLine("            var date = this._restrictMinMax(inst,")
        sb.AppendLine("			this._daylightSavingAdjust(new Date(year, month, day)));")
        sb.AppendLine("            inst.selectedDay = date.getDate();")
        sb.AppendLine("            inst.drawMonth = inst.selectedMonth = date.getMonth();")
        sb.AppendLine("            inst.drawYear = inst.selectedYear = date.getFullYear();")
        sb.AppendLine("            if (period == 'M' || period == 'Y')")
        sb.AppendLine("                this._notifyChange(inst);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Ensure a date is within any min/max bounds. */")
        sb.AppendLine("        _restrictMinMax: function(inst, date) {")
        sb.AppendLine("            var minDate = this._getMinMaxDate(inst, 'min');")
        sb.AppendLine("            var maxDate = this._getMinMaxDate(inst, 'max');")
        sb.AppendLine("            date = (minDate && date < minDate ? minDate : date);")
        sb.AppendLine("            date = (maxDate && date > maxDate ? maxDate : date);")
        sb.AppendLine("            return date;")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Notify change of month/year. */")
        sb.AppendLine("        _notifyChange: function(inst) {")
        sb.AppendLine("            var onChange = this._get(inst, 'onChangeMonthYear');")
        sb.AppendLine("            if (onChange)")
        sb.AppendLine("                onChange.apply((inst.input ? inst.input[0] : null),")
        sb.AppendLine("				[inst.selectedYear, inst.selectedMonth + 1, inst]);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Determine the number of months to show. */")
        sb.AppendLine("        _getNumberOfMonths: function(inst) {")
        sb.AppendLine("            var numMonths = this._get(inst, 'numberOfMonths');")
        sb.AppendLine("            return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Determine the current maximum date - ensure no time components are set. */")
        sb.AppendLine("        _getMinMaxDate: function(inst, minMax) {")
        sb.AppendLine("            return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Find the number of days in a given month. */")
        sb.AppendLine("        _getDaysInMonth: function(year, month) {")
        sb.AppendLine("            return 32 - new Date(year, month, 32).getDate();")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Find the day of the week of the first of a month. */")
        sb.AppendLine("        _getFirstDayOfMonth: function(year, month) {")
        sb.AppendLine("            return new Date(year, month, 1).getDay();")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Determines if we should allow a ""next/prev"" month display change. */")
        sb.AppendLine("        _canAdjustMonth: function(inst, offset, curYear, curMonth) {")
        sb.AppendLine("            var numMonths = this._getNumberOfMonths(inst);")
        sb.AppendLine("            var date = this._daylightSavingAdjust(new Date(curYear,")
        sb.AppendLine("			curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));")
        sb.AppendLine("            if (offset < 0)")
        sb.AppendLine("                date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));")
        sb.AppendLine("            return this._isInRange(inst, date);")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Is the given date in the accepted range? */")
        sb.AppendLine("        _isInRange: function(inst, date) {")
        sb.AppendLine("            var minDate = this._getMinMaxDate(inst, 'min');")
        sb.AppendLine("            var maxDate = this._getMinMaxDate(inst, 'max');")
        sb.AppendLine("            return ((!minDate || date.getTime() >= minDate.getTime()) &&")
        sb.AppendLine("			(!maxDate || date.getTime() <= maxDate.getTime()));")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("        /* Provide the configuration settings for formatting/parsing. */")
        sb.AppendLine("        _getFormatConfig: function(inst) {")
        sb.AppendLine("            var shortYearCutoff = this._get(inst, 'shortYearCutoff');")
        sb.AppendLine("            shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :")
        sb.AppendLine("			new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));")
        sb.AppendLine("            return { shortYearCutoff: shortYearCutoff,")
        sb.AppendLine("                dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),")
        sb.AppendLine("                monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')")
        sb.AppendLine("            };")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("")
        sb.AppendLine("")
        sb.AppendLine("        /* find position on the screen */")
        sb.AppendLine("        _findPos: function findPos(obj) {")
        sb.AppendLine("            var curleft = curtop = 0;")
        sb.AppendLine("            if (obj.offsetParent) {")
        sb.AppendLine("                do {")
        sb.AppendLine("                    curleft += obj.offsetLeft;")
        sb.AppendLine("                    curtop += obj.offsetTop;")
        sb.AppendLine("                } while (obj = obj.offsetParent);")
        sb.AppendLine("                return [curleft, curtop];")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("        _Right: function(str, n) {")
        sb.AppendLine("            if (n <= 0)")
        sb.AppendLine("                return """";")
        sb.AppendLine("            else if (n > String(str).length)")
        sb.AppendLine("                return str;")
        sb.AppendLine("            else {")
        sb.AppendLine("                var iLen = String(str).length;")
        sb.AppendLine("                return String(str).substring(iLen, iLen - n);")
        sb.AppendLine("            }")
        sb.AppendLine("        },")
        sb.AppendLine("")
        sb.AppendLine("")
        sb.AppendLine("        /* Format the given date for display. */")
        sb.AppendLine("        _formatDate: function(inst, day, month, year) {")
        sb.AppendLine("            if (!day) {")
        sb.AppendLine("                inst.currentDay = inst.selectedDay;")
        sb.AppendLine("                inst.currentMonth = inst.selectedMonth;")
        sb.AppendLine("                inst.currentYear = inst.selectedYear;")
        sb.AppendLine("                inst.currentHour = inst.selectedHour;")
        sb.AppendLine("                inst.currentAMPM = inst.selectedAMPM;")
        sb.AppendLine("                inst.currentMinute = inst.selectedMinute;")
        sb.AppendLine("            }")
        sb.AppendLine("")
        sb.AppendLine("            var Hour = inst.currentHour;")
        sb.AppendLine("            if (Hour > 12)")
        sb.AppendLine("                Hour = Hour - 12;")
        sb.AppendLine("            inst.currentMonth += 1;")
        sb.AppendLine("            var MinuteString = inst.currentMinute;")
        sb.AppendLine("            if (MinuteString.length == 1)")
        sb.AppendLine("                MinuteString = ""0"" + MinuteString;")
        sb.AppendLine("            var DateString = '' + inst.currentMonth + '/' + inst.selectedDay + '/' + inst.selectedYear + ' ' + Hour + ':' + MinuteString + ' ' + inst.currentAMPM;")
        sb.AppendLine("            var date = new Date(DateString);")
        sb.AppendLine("            return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));")
        sb.AppendLine("        }")
        sb.AppendLine("    });")
        sb.AppendLine("")
        sb.AppendLine("    /* jQuery extend now ignores nulls! */")
        sb.AppendLine("    function extendRemove(target, props) {")
        sb.AppendLine("        $.extend(target, props);")
        sb.AppendLine("        for (var name in props)")
        sb.AppendLine("            if (props[name] == null || props[name] == undefined)")
        sb.AppendLine("            target[name] = props[name];")
        sb.AppendLine("        return target;")
        sb.AppendLine("    };")
        sb.AppendLine("")
        sb.AppendLine("    /* Determine whether an object is an array. */")
        sb.AppendLine("    function isArray(a) {")
        sb.AppendLine("        return (a && (($.browser.safari && typeof a == 'object' && a.length) ||")
        sb.AppendLine("		(a.constructor && a.constructor.toString().match(/\Array\(\)/))));")
        sb.AppendLine("    };")
        sb.AppendLine("")
        sb.AppendLine("    /* Invoke the datepicker functionality.")
        sb.AppendLine("    @param  options  string - a command, optionally followed by additional parameters or")
        sb.AppendLine("    Object - settings for attaching new datepicker functionality")
        sb.AppendLine("    @return  jQuery object */")
        sb.AppendLine("    $.fn.datetimepicker = function(options) {")
        sb.AppendLine("")
        sb.AppendLine("        /* Initialise the date picker. */")
        sb.AppendLine("        if (!$.datetimepicker.initialized) {")
        sb.AppendLine("            $(document).mousedown($.datetimepicker._checkExternalClick).")
        sb.AppendLine("			find('body').append($.datetimepicker.dpDiv);")
        sb.AppendLine("            $.datetimepicker.initialized = true;")
        sb.AppendLine("        }")
        sb.AppendLine("")
        sb.AppendLine("        var otherArgs = Array.prototype.slice.call(arguments, 1);")
        sb.AppendLine("        if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))")
        sb.AppendLine("            return $.datetimepicker['_' + options + 'Datepicker'].")
        sb.AppendLine("			apply($.datetimepicker, [this[0]].concat(otherArgs));")
        sb.AppendLine("        if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')")
        sb.AppendLine("            return $.datetimepicker['_' + options + 'Datepicker'].")
        sb.AppendLine("			apply($.datetimepicker, [this[0]].concat(otherArgs));")
        sb.AppendLine("        return this.each(function() {")
        sb.AppendLine("            typeof options == 'string' ?")
        sb.AppendLine("			$.datetimepicker['_' + options + 'Datepicker'].")
        sb.AppendLine("				apply($.datetimepicker, [this].concat(otherArgs)) :")
        sb.AppendLine("			$.datetimepicker._attachDatepicker(this, options);")
        sb.AppendLine("        });")
        sb.AppendLine("    };")
        sb.AppendLine("")
        sb.AppendLine("    $.datetimepicker = new Datetimepicker(); // singleton instance")
        sb.AppendLine("    $.datetimepicker.initialized = false;")
        sb.AppendLine("    $.datetimepicker.uuid = new Date().getTime();")
        sb.AppendLine("    $.datetimepicker.version = ""1.8rc3"";")
        sb.AppendLine("")
        sb.AppendLine("    // Workaround for #4055")
        sb.AppendLine("    // Add another global to avoid noConflict issues with inline event handlers")
        sb.AppendLine("    window['DP_jQuery_' + dpuuid] = $;")
        sb.AppendLine("")
        sb.AppendLine("})(jQuery);")
        sb.AppendLine("")
        sb.AppendLine("/*")
        sb.AppendLine("* Date Format 1.2.3")
        sb.AppendLine("*/")
        sb.AppendLine("")
        sb.AppendLine("var RegexDateFormat = function() {")
        sb.AppendLine("    var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|""[^""]*""|'[^']*'/g,")
        sb.AppendLine("		timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,")
        sb.AppendLine("		timezoneClip = /[^-+\dA-Z]/g,")
        sb.AppendLine("		pad = function(val, len) {")
        sb.AppendLine("		    val = String(val);")
        sb.AppendLine("		    len = len || 2;")
        sb.AppendLine("		    while (val.length < len) val = ""0"" + val;")
        sb.AppendLine("		    return val;")
        sb.AppendLine("		};")
        sb.AppendLine("")
        sb.AppendLine("    // Regexes and supporting functions are cached through closure")
        sb.AppendLine("    return function(date, mask, utc) {")
        sb.AppendLine("        var dF = RegexDateFormat;")
        sb.AppendLine("")
        sb.AppendLine("        // You can't provide utc if you skip other args (use the ""UTC:"" mask prefix)")
        sb.AppendLine("        if (arguments.length == 1 && Object.prototype.toString.call(date) == ""[object String]"" && !/\d/.test(date)) {")
        sb.AppendLine("            mask = date;")
        sb.AppendLine("            date = undefined;")
        sb.AppendLine("        }")
        sb.AppendLine("")
        sb.AppendLine("        // Passing date through Date applies Date.parse, if necessary")
        sb.AppendLine("        date = date ? new Date(date) : new Date;")
        sb.AppendLine("        if (isNaN(date)) throw SyntaxError(""invalid date"");")
        sb.AppendLine("")
        sb.AppendLine("        mask = String(dF.masks[mask] || mask || dF.masks[""default""]);")
        sb.AppendLine("")
        sb.AppendLine("        // Allow setting the utc argument via the mask")
        sb.AppendLine("        if (mask.slice(0, 4) == ""UTC:"") {")
        sb.AppendLine("            mask = mask.slice(4);")
        sb.AppendLine("            utc = true;")
        sb.AppendLine("        }")
        sb.AppendLine("")
        sb.AppendLine("        var _ = utc ? ""getUTC"" : ""get"",")
        sb.AppendLine("			d = date[_ + ""Date""](),")
        sb.AppendLine("			D = date[_ + ""Day""](),")
        sb.AppendLine("			m = date[_ + ""Month""](),")
        sb.AppendLine("			y = date[_ + ""FullYear""](),")
        sb.AppendLine("			H = date[_ + ""Hours""](),")
        sb.AppendLine("			M = date[_ + ""Minutes""](),")
        sb.AppendLine("			s = date[_ + ""Seconds""](),")
        sb.AppendLine("			L = date[_ + ""Milliseconds""](),")
        sb.AppendLine("			o = utc ? 0 : date.getTimezoneOffset(),")
        sb.AppendLine("			flags = {")
        sb.AppendLine("			    d: d,")
        sb.AppendLine("			    dd: pad(d),")
        sb.AppendLine("			    ddd: dF.i18n.dayNames[D],")
        sb.AppendLine("			    dddd: dF.i18n.dayNames[D + 7],")
        sb.AppendLine("			    m: m + 1,")
        sb.AppendLine("			    mm: pad(m + 1),")
        sb.AppendLine("			    mmm: dF.i18n.monthNames[m],")
        sb.AppendLine("			    mmmm: dF.i18n.monthNames[m + 12],")
        sb.AppendLine("			    yy: String(y).slice(2),")
        sb.AppendLine("			    yyyy: y,")
        sb.AppendLine("			    h: H % 12 || 12,")
        sb.AppendLine("			    hh: pad(H % 12 || 12),")
        sb.AppendLine("			    H: H,")
        sb.AppendLine("			    HH: pad(H),")
        sb.AppendLine("			    M: M,")
        sb.AppendLine("			    MM: pad(M),")
        sb.AppendLine("			    s: s,")
        sb.AppendLine("			    ss: pad(s),")
        sb.AppendLine("			    l: pad(L, 3),")
        sb.AppendLine("			    L: pad(L > 99 ? Math.round(L / 10) : L),")
        sb.AppendLine("			    t: H < 12 ? ""a"" : ""p"",")
        sb.AppendLine("			    tt: H < 12 ? ""am"" : ""pm"",")
        sb.AppendLine("			    T: H < 12 ? ""A"" : ""P"",")
        sb.AppendLine("			    TT: H < 12 ? ""AM"" : ""PM"",")
        sb.AppendLine("			    Z: utc ? ""UTC"" : (String(date).match(timezone) || [""""]).pop().replace(timezoneClip, """"),")
        sb.AppendLine("			    o: (o > 0 ? ""-"" : ""+"") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),")
        sb.AppendLine("			    S: [""th"", ""st"", ""nd"", ""rd""][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]")
        sb.AppendLine("			};")
        sb.AppendLine("")
        sb.AppendLine("        return mask.replace(token, function($0) {")
        sb.AppendLine("            return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);")
        sb.AppendLine("        });")
        sb.AppendLine("    };")
        sb.AppendLine("} ();")
        sb.AppendLine("")
        sb.AppendLine("// Some common format strings")
        sb.AppendLine("RegexDateFormat.masks = {")
        sb.AppendLine("    ""default"": ""ddd mmm dd yyyy HH:MM:ss"",")
        sb.AppendLine("    shortDate: ""m/d/yy"",")
        sb.AppendLine("    mediumDate: ""mmm d, yyyy"",")
        sb.AppendLine("    longDate: ""mmmm d, yyyy"",")
        sb.AppendLine("    fullDate: ""dddd, mmmm d, yyyy"",")
        sb.AppendLine("    shortTime: ""h:MM TT"",")
        sb.AppendLine("    mediumTime: ""h:MM:ss TT"",")
        sb.AppendLine("    longTime: ""h:MM:ss TT Z"",")
        sb.AppendLine("    isoDate: ""yyyy-mm-dd"",")
        sb.AppendLine("    isoTime: ""HH:MM:ss"",")
        sb.AppendLine("    isoDateTime: ""yyyy-mm-dd'T'HH:MM:ss"",")
        sb.AppendLine("    isoUtcDateTime: ""UTC:yyyy-mm-dd'T'HH:MM:ss'Z'""")
        sb.AppendLine("};")
        sb.AppendLine("")
        sb.AppendLine("// Internationalization strings")
        sb.AppendLine("RegexDateFormat.i18n = {")
        sb.AppendLine("    dayNames: [")
        sb.AppendLine("		""Sun"", ""Mon"", ""Tue"", ""Wed"", ""Thu"", ""Fri"", ""Sat"",")
        sb.AppendLine("		""Sunday"", ""Monday"", ""Tuesday"", ""Wednesday"", ""Thursday"", ""Friday"", ""Saturday""")
        sb.AppendLine("	],")
        sb.AppendLine("    monthNames: [")
        sb.AppendLine("		""Jan"", ""Feb"", ""Mar"", ""Apr"", ""May"", ""Jun"", ""Jul"", ""Aug"", ""Sep"", ""Oct"", ""Nov"", ""Dec"",")
        sb.AppendLine("		""January"", ""February"", ""March"", ""April"", ""May"", ""June"", ""July"", ""August"", ""September"", ""October"", ""November"", ""December""")
        sb.AppendLine("	]")
        sb.AppendLine("};")
        sb.AppendLine("")
        sb.AppendLine("")
        sb.AppendLine("// For convenience...")
        sb.AppendLine("Date.prototype.format = function(mask, utc) {")
        sb.AppendLine("    return RegexDateFormat(this, mask, utc);")
        sb.AppendLine("};")
        sb.AppendLine("")
        sb.AppendLine("")

        Return sb.tostring
    End Function

End Class
